Commit Graph

32392 Commits

Author SHA1 Message Date
Hui Zhu 5c2b44181d 2013-04-10 Pedro Alves <palves@redhat.com>
Hui Zhu  <hui@codesourcery.com>

	* breakpoint.c (dprintf_re_set): New.
	(initialize_breakpoint_ops): Set dprintf_breakpoint_ops re_set
	to dprintf_re_set.

2013-04-10  Hui Zhu  <hui@codesourcery.com>

	* gdb.base/Makefile.in (EXECUTABLES): Add dprintf-pending.
	(MISCELLANEOUS): Add dprintf-pendshr.sl.
	* gdb.base/dprintf-pending.c, gdb.base/dprintf-pending.exp: New.
2013-04-10 04:35:21 +00:00
Joel Brobecker a5c6673503 Remove solib-svr4.o from gdb_target_obs for ppc-aix.
gdb/ChangeLog:

        * configure.tgt (gdb_target_obs) <powerpc-*-aix* | rs6000-*-*>:
        Remove solib-svr4.o from the list.
2013-04-10 00:47:32 +00:00
gdbadmin 066938319f *** empty log message *** 2013-04-10 00:00:03 +00:00
Joel Brobecker 9e77999c3a Fix build failure in varobj.c:update_dynamic_varobj_children...
... when !HAVE_PYTHON.

gdb/ChangeLog:

        * varobj.c (update_dynamic_varobj_children) [!HAVE_PYTHON]:
        Use gdb_assert_not_reached instead of invalid boolean expression.
2013-04-09 23:30:50 +00:00
Jan Kratochvil f7543f0a4f gdb/testsuite/
* gdb.server/server-kill.exp (tstatus): Permit also ECONNRESET
	response.
2013-04-09 15:26:44 +00:00
Pedro Alves 1927e61863 Avoid potencially-stale errno usage.
The current throw_perror_with_name/TARGET_CLOSE_ERROR calls assume
errno is still set to the right error, although remote_unpush_target
is called in between, which may well change errno.

Tested on x86_64 Fedora 17 w/ gdbserver.

gdb/
2013-04-09  Pedro Alves  <palves@redhat.com>

	* remote.c (unpush_and_perror): New function.
	(readchar, remote_serial_write): Use it.
2013-04-09 12:18:34 +00:00
Markus Metzger 10782d74c0 gdb/
* NEWS: Mention new btrace RSP packets.
2013-04-09 08:04:32 +00:00
Tom Tromey 4c8429eff1 * symmisc.c (dump_msymbols): Cast fprintf_filtered argument to
long.
2013-04-09 02:17:17 +00:00
gdbadmin 6b2021910a *** empty log message *** 2013-04-09 00:00:03 +00:00
Tom Tromey 8625fc1bba * maint.c (print_bfd_section_info): Print the section index.
* symmisc.c (dump_msymbols): Print the section index.
2013-04-08 20:20:46 +00:00
Tom Tromey e27d198cc4 PR symtab/8424:
* blockframe.c (find_pc_partial_function_gnu_ifunc): Check
	SYMBOL_SECTION, not SYMBOL_OBJ_SECTION.
	* breakpoint.c (resolve_sal_pc): Update.
	* elfread.c (elf_gnu_ifunc_record_cache): Update.
	* findvar.c (struct minsym_lookup_data) <objfile>: New field.
	(minsym_lookup_iterator_cb): Use it.
	(default_read_var_value): Update.
	* hppa-hpux-tdep.c (hppa64_hpux_in_solib_call_trampoline):
	Update.
	* infcmd.c (jump_command): Update.
	* linespec.c (minsym_found): Update.
	* maint.c (maintenance_translate_address): Update.
	* minsyms.c (lookup_minimal_symbol_by_pc_section_1): Update.
	(prim_record_minimal_symbol_full): Don't set SYMBOL_OBJ_SECTION.
	* parse.c (write_exp_msymbol): Update.
	* printcmd.c (address_info): Update.
	* psymtab.c (find_pc_sect_psymbol): Update.
	(fixup_psymbol_section): Check SYMBOL_SECTION, not
	SYMBOL_OBJ_SECTION.
	(add_psymbol_to_bcache): Correctly initialize SYMBOL_SECTION.
	Don't initialize SYMBOL_OBJ_SECTION.
	* spu-tdep.c (spu_catch_start): Update.
	* stabsread.c (define_symbol): Don't set SYMBOL_SECTION.
	* symmisc.c (dump_msymbols, print_symbol): Update.
	* symtab.c (fixup_section): Don't set 'obj_section'.  Change
	how fallback section is computed.
	(fixup_symbol_section): Update.
	(find_pc_sect_symtab, find_function_start_sal, skip_prologue_sal):
	Update.
	(allocate_symbol, initialize_symbol, allocate_template_symbol):
	Initialize SYMBOL_SECTION.
	* symtab.h (struct general_symbol_info) <section>: Update comment.
	<obj_section>: Remove.
	(SYMBOL_OBJ_SECTION): Add 'objfile' argument.  Rewrite.
	(SYMBOL_OBJFILE): New macro.
2013-04-08 20:18:11 +00:00
Tom Tromey e6dc44a8f5 * coffread.c (record_minimal_symbol): Update.
* dbxread.c (record_minimal_symbol): Update.
	* elfread.c (record_minimal_symbol): Update.
	* machoread.c (macho_symtab_add_minsym): Update.
	* mdebugread.c (record_minimal_symbol, parse_partial_symbols):
	Update.
	* minsyms.c (prim_record_minimal_symbol): Update.
	(prim_record_minimal_symbol_full): Remove 'bfd_section'
	argument.
	(prim_record_minimal_symbol_and_info): Likewise.
	* minsyms.h (prim_record_minimal_symbol_full)
	(prim_record_minimal_symbol_and_info): Update.
	* symtab.c (allocate_symbol, initialize_symbol)
	(allocate_template_symbol): Initialize SYMBOL_SECTION.
	* xcoffread.c (record_minimal_symbol, scan_xcoff_symtab):
	Update.
2013-04-08 20:13:22 +00:00
Tom Tromey 36192a8d54 PR symtab/8423:
* solib-som.c (som_solib_section_offsets): Use BFD section
	indices.  Set offsets for all sections.
	* somread.c (som_symtab_read): Compute BFD section for
	symbol.  Use prim_record_minimal_symbol_and_info.
	(som_symfile_read): Fix comment.
	(struct find_section_offset_arg): New.
	(find_section_offset, set_section_index): New functions.
	(som_symfile_offsets): Use set_section_index to compute
	section indices.
bfd/
	* som.c (bfd_section_from_som_symbol): No longer static.
	* som.h (bfd_section_from_som_symbol): Declare.
2013-04-08 20:08:21 +00:00
Tom Tromey 65cf356359 * coffread.c (cs_to_section): Use gdb_bfd_section_index.
* elfread.c (record_minimal_symbol, elf_symtab_read): Use
	gdb_bfd_section_index.
	* gdb_bfd.c (gdb_bfd_section_index, gdb_bfd_count_sections):
	New functions.
	* gdb_bfd.h (gdb_bfd_section_index, gdb_bfd_count_sections):
	Declare.
	* machoread.c (macho_symtab_add_minsym, macho_symfile_offsets):
	Update.
	* objfiles.c (add_to_objfile_sections_full): New function.
	(add_to_objfile_sections): Use it.
	(build_section_table): Rewrite.
	(objfile_relocate1): Use gdb_bfd_section_index.  Update.
	* objfiles.h (obj_section_offset): Use gdb_bfd_section_index.
	(struct objfile) <sections>: Update comment.
	(ALL_OBJFILE_OSECTIONS): Skip sections where the_bfd_section
	is NULL.
	(ALL_OBJSECTIONS): Use it.
	* solib-dsbt.c (dsbt_relocate_main_executable): Update.
	* solib-frv.c (frv_relocate_main_executable): Update.
	* solib-target.c (solib_target_relocate_section_addresses):
	Use gdb_bfd_section_index.
	* symfile.c (build_section_addr_info_from_section_table):
	Use gdb_bfd_section_index.
	(build_section_addr_info_from_bfd, place_section): Likewise.
	* symtab.c (fixup_section): Update.
	* xcoffread.c (find_targ_sec): Use gdb_bfd_section_index.
2013-04-08 20:04:42 +00:00
Tom Tromey 7cbd4a934e * minsyms.h (struct bound_minimal_symbol): New.
(lookup_minimal_symbol_and_objfile): Return bound_minimal_symbol.
	Remove objfile argument.
	(lookup_minimal_symbol_by_pc_section, lookup_minimal_symbol_by_pc):
	Return bound_minimal_symbol.
	* minsyms.c (lookup_minimal_symbol_by_pc_1)
	(lookup_minimal_symbol_by_pc_section, lookup_minimal_symbol_by_pc):
	Return bound_minimal_symbol.
	(in_gnu_ifunc_stub): Update.
	(lookup_minimal_symbol_and_objfile): Return bound_minimal_symbol.
	Remove 'objfile_p' argument.
	(lookup_solib_trampoline_symbol_by_pc): Update.
	* ada-tasks.c, amd64-windows-tdep.c, arm-tdep.c,
	arm-wince-tdep.c, block.c, blockframe.c, breakpoint.c, btrace.c,
	c-valprint.c, dwarf2loc.c, elfread.c, frame.c, frv-tdep.c,
	glibc-tdep.c, gnu-v2-abi.c, gnu-v3-abi.c, hppa-hpux-tdep.c,
	i386-tdep.c, ia64-tdep.c, infcall.c, infcmd.c, jit.c,
	linux-fork.c, m32c-tdep.c, m68hc11-tdep.c, maint.c,
	mips-tdep.c, p-valprint.c, parse.c, ppc-linux-tdep.c,
	ppc-sysv-tdep.c, printcmd.c, rs6000-tdep.c, sh64-tdep.c,
	stack.c, symtab.c, tui/tui-disasm.c: Update.
2013-04-08 19:59:09 +00:00
Tom Tromey f85f34ede8 * ada-lang.c (ada_decode_symbol): Check and set 'ada_mangled'.
Use symbol's obstack, not an objfile.
	* coffread.c (process_coff_symbol): Update.
	* dwarf2read.c (fixup_go_packaging, new_symbol_full): Update.
	* jv-lang.c (add_class_symbol): Update.
	* mdebugread.c (new_symbol): Update.
	* minsyms.c (prim_record_minimal_symbol_full)
	(terminate_minimal_symbol_table): Update.
	* psymtab.c (add_psymbol_to_bcache): Clear entire symbol.  Update.
	* stabsread.c (define_symbol, read_enum_type): Update.
	* symtab.c (symbol_set_demangled_name, symbol_get_demangled_name):
	Handle Ada specially.
	(symbol_set_language): Add 'obstack' argument.
	(symbol_set_names): Update.
	(symbol_natural_name, symbol_demangled_name): Always use
	ada_decode_symbol.
	* symtab.h (struct general_symbol_info)
	<language_specific::obstack>: New field.
	<ada_mangled>: New field.
	(SYMBOL_SET_LANGUAGE): Add 'obstack' argument.
	(symbol_set_language): Update.
2013-04-08 19:56:03 +00:00
Tom Tromey ccde22c0a4 * symtab.c (symbol_init_cplus_specific, symbol_set_demangled_name):
Take an obstack, not an objfile.
	(symbol_set_names): Update.
	* symtab.h (symbol_set_demangled_name): Update.
2013-04-08 19:53:18 +00:00
Tom Tromey e623cf5da2 * coffread.c (process_coff_symbol, coff_read_enum_type): Call
allocate_symbol.
	* dwarf2read.c (fixup_go_packaging): Call allocate_symbol.
	(read_func_scope): Call allocate_template_symbol.
	(new_symbol_full): Call allocate_symbol.
	* jit.c (finalize_symtab): Call allocate_symbol.
	* jv-lang.c (add_class_symbol): Call allocate_symbol.
	* mdebugread.c (parse_symbol, new_block): Call allocate_symbol.
	* stabsread.c (patch_block_stabs, define_symbol, read_enum_type)
	(common_block_end): Call allocate_symbol.
	* symtab.c (allocate_symbol, initialize_symbol)
	(allocate_template_symbol): New functions.
	* symtab.c (allocate_symbol, initialize_symbol)
	(allocate_template_symbol): Declare.
	* xcoffread.c (process_xcoff_symbol): Call initialize_symbol.
2013-04-08 19:48:30 +00:00
Pedro Alves f6de8ec262 create_breapoint / explicit mode: Error out if there's garbage after the breakpoint location.
If !PARSE_CONDITION_AND_THREAD, then ARG is just the location, nothing
else.  The fact that the describing comment of create_breakpoint
doesn't mention this just looks like an oversight of when extra_string
was added.  "parse_condition_and_thread" has been a misnomer ever
since extra_string was added -- better rename it avoid more confusion.
This makes it "parse_arg", as that'll remain stable even if/when more
explicit parameters are added.

gdb/
2013-04-08  Pedro Alves  <palves@redhat.com>
	    Keith Seitz  <keiths@redhat.com>

	* breakpoint.c (create_breakpoint): Rename
	"parse_condition_and_thread" parameter to "parse_arg".  Update
	describing comment.  If !PARSE_ARG, then error out if ARG is not
	the empty string after extracting the location.
	* breakpoint.h (create_breakpoint): Rename
	"parse_condition_and_thread" parameter to "parse_arg".

gdb/testsuite/
2013-04-08  Pedro Alves  <palves@redhat.com>

	* gdb.mi/mi-break.exp (test_error): Add tests with garbage after
	the location.
2013-04-08 14:09:30 +00:00
Aleksandar Ristovski f65ce5fb99 Add const to lm_addr_check.
* solib-svr4.c (lm_addr_check): Add const qualifier to 'so' arg.
2013-04-08 14:03:56 +00:00
gdbadmin 934335bf47 *** empty log message *** 2013-04-08 00:00:02 +00:00
Yao Qi cc5925ad7e gdb/
* remote.c (remote_trace_find): Change type of parameters 'addr1'
	and 'addr2' to CORE_ADDR.
	* target.c (update_current_target): Update.
	* target.h (struct target_ops) <to_trace_find>: Change parameter
	type to CORE_ADDR.
	* tracepoint.c (tfind_1): Change type of parameters 'addr1' and
	'addr2' to CORE_ADDR.
	(tfile_trace_find): Likewise.
	(tfile_get_traceframe_address): Change return type to CORE_ADDR.
	Change local variable 'addr' to type CORE_ADDR.
	* tracepoint.h (tfind_1): Update declaration.
2013-04-07 10:23:34 +00:00
Jan Kratochvil afe1492b21 gdb/doc/
* Makefile.in (gdb.1, gdbserver.1, gdbinit.5): Use $(srcdir).
2013-04-07 06:20:19 +00:00
Jan Kratochvil 0ed630cb00 gdb/doc/
* Makefile.in (install-man1, install-man5, uninstall-man1)
	(uninstall-man5): Replace $(MANS) by $(MAN1S) and $(MAN5S) respectively.
2013-04-07 06:04:58 +00:00
Jan Kratochvil 480b27bfaa gdb/gdbserver/
* Makefile.in (install-only): Fix make install regression.
2013-04-07 05:53:22 +00:00
gdbadmin 4ebcdc5d1a *** empty log message *** 2013-04-07 00:00:03 +00:00
Jan Kratochvil cba5a7bf0f gdb/doc/
* Makefile.in (POD2MAN1, POD2MAN5): Replace $(VERSION) by ../version.in.
2013-04-06 15:52:06 +00:00
Jan Kratochvil 5b8b6385be gdb/doc/
* gdb.texinfo (gdbserver man): Rename tty to comm.  Swap --attach
	parameters order.  Remove "On some targets" for --attach.  Document the
	--multi parameter and extended-remote command.  Document all the
	options.
2013-04-06 08:58:53 +00:00
Eli Zaretskii d9ac066415 Unbreak Windows-hosted cross debugger builds.
* windows-nat.c (windows_get_absolute_argv0): Move from here...
	* mingw-hdep.c (windows_get_absolute_argv0): ...to here.
	Include main.h.

	* windows-nat.h (windows_get_absolute_argv0): Move prototype from
	here...
	* main.h (windows_get_absolute_argv0): ...to here.
2013-04-06 06:52:06 +00:00
gdbadmin 524d4a957a *** empty log message *** 2013-04-06 00:00:03 +00:00
Doug Evans 02142a6c8b * dwarf2read.c (struct dwarf2_per_objfile): Tweak comment.
(read_cutu_die_from_dwo): Add comments.
	(read_structure_type): Update comment.
	(read_enumeration_type, read_namespace_type): Update comment.
	(read_die_type, get_die_type_at_offset, get_die_type): Update comment.
2013-04-05 21:48:25 +00:00
Jan Kratochvil 906ccdf016 gdb/doc/
* gdb.texinfo (gdb man): Mention option -p.  Include Fortran to
	the list of supported languages.
2013-04-05 20:02:58 +00:00
Jan Kratochvil 43662968f1 gdb/
Convert man pages to texinfo, new gdbinit.5 texinfo page.
	* Makefile.in (gdb.z): Remove.
	(install-only): Remove $(man1dir) and gdb.1 installation.
	* gdb.1: Remove.

gdb/gdbserver/
	Convert man pages to texinfo, new gdbinit.5 texinfo page.
	* Makefile.in (install-only): Remove $(man1dir) and gdbserver.1
	installation.
	* gdbserver.1: Remove.

gdb/doc/
	Convert man pages to texinfo, new gdbinit.5 texinfo page.
	* Makefile.in (mandir, man1dir, man5dir, SYSTEM_GDBINIT, MANCONF,
	(TEXI2POD, POD2MAN1, POD2MAN5, MAN1S, MAN5S, MANS, man): New.
	(diststuff): Add man.
	(install-man, install-man1, install-man5, uninstall-man, uninstall-man1)
	(uninstall-man5): New.
	(STAGESTUFF): Add *.1 and *.5.
	(GDBvn.texi): Add SYSTEM_GDBINIT.
	(gdb.1, gdbserver.1, gdbinit.5): New.
	(maintainer-clean realclean): Add $(MANS).
	(install): Add install-man.
	(uninstall): Add uninstall-man.
	* gdb.texinfo (@include gdb-cfg.texi): Wrap it by @c man begin INCLUDE.
	(@copying): Wrap it by @c man begin COPYRIGHT.
	(Top): Add Man Pages.
	(Man Pages, gdb man, gdbserver man, gdbinit man): New.
2013-04-05 20:01:33 +00:00
Jan Kratochvil 9ead1b844c gdb/
Fix compatibility with Linux kernel 3.8.3.
	* linux-tdep.c (linux_find_memory_regions_full): Move variable number
	to more inner block.  Remove parsing of NUMBER from outer block.
	Parse NUMBER only if KEYWORD has been identified.
2013-04-05 19:17:15 +00:00
Jan Kratochvil d1794952ba gdb/
Fix variable name shadowing.
	* linux-tdep.c (linux_find_memory_regions_full): Rename outer variable
	filename to mapsfilename and update its uses.
2013-04-05 19:14:44 +00:00
Eli Zaretskii 9025569e3a Avoid warning in "make tags".
* Makefile.in (TAGS): Avoid warning from etags when $GDB_NM_FILE is
	empty.  See http://sourceware.org/ml/gdb-patches/2012-08/msg00504.html
	and http://sourceware.org/ml/gdb-patches/2013-04/msg00055.html for
	details of the problem.
2013-04-05 13:24:24 +00:00
gdbadmin 4b7654eed7 *** empty log message *** 2013-04-05 00:00:02 +00:00
Sandra Loosemore b8abfd5827 2013-04-04 Sandra Loosemore <sandra@codesourcery.com>
gdb/testsuite/

	* gdb.cp/cplabel.exp: Allow empty directory in file reported
	for breakpoint location.
2013-04-04 21:01:40 +00:00
Sandra Loosemore 156bffd096 2013-04-04 Sandra Loosemore <sandra@codesourcery.com>
gdb/testsuite/

	* gdb.linespec/linespec.exp: Make dir/file:line tests
	conditional for non-remote hosts only.
2013-04-04 20:59:12 +00:00
Pedro Alves c9a6ce02b5 tracepoint->step_count fixes
If a tracepoint's actions list includes a while-stepping action, and
then the actions are changed to a list without any while-stepping
action, the tracepoint's step_count will be left with a stale value.
For example:

 (gdb) trace subr
 Tracepoint 1 at 0x4004d9: file ../../../src/gdb/testsuite//actions-changed.c, line 31.
 (gdb) actions
 Enter actions for tracepoint 1, one per line.
 End with a line saying just "end".
 >collect $reg
 >end
 (gdb) set debug remote 1
 (gdb) tstart
 Sending packet: $QTinit#59...Packet received: OK
 Sending packet: $QTDP:1:00000000004004d9:E:0:0-#a3...Packet received: OK
 Sending packet: $QTDP👎00000000004004d9:R03FFFFFFFFFFFFFFFFFF#2b...Packet received: OK
 (gdb) tstop
 Sending packet: $QTStop#4b...Packet received: OK
 Sending packet: $QTNotes:#e8...Packet received: OK
 (gdb) actions
 Enter actions for tracepoint 1, one per line.
 End with a line saying just "end".
 >collect $reg
 >while-stepping 1
   >collect $reg
   >end
 >end
 (gdb) tstart
 Sending packet: $QTinit#59...Packet received: OK
 Sending packet: $QTDP:1:00000000004004d9:E:1:0-#a4...Packet received: OK
 Sending packet: $QTDP👎00000000004004d9:R03FFFFFFFFFFFFFFFFFF-#58...Packet received: OK
 Sending packet: $QTDP👎00000000004004d9:SR03FFFFFFFFFFFFFFFFFF#7e...Packet received: OK
 (gdb) tstop
 Sending packet: $QTStop#4b...Packet received: OK
 Sending packet: $QTNotes:#e8...Packet received: OK
 (gdb) actions
 Enter actions for tracepoint 1, one per line.
 End with a line saying just "end".
 >collect $regs
 >end
 (gdb) tstart
 Sending packet: $QTinit#59...Packet received: OK
 Sending packet: $QTDP:1:00000000004004d9:E:1:0-#a4...Packet received: OK
 Sending packet: $QTDP👎00000000004004d9:R03FFFFFFFFFFFFFFFFFF#2b...Packet received: OK

The last "$QTDP:1:00000000004004d9:E:1:0-#a4" should be "$QTDP:1:00000000004004d9:E:0:0-#a3".
In pseudo-diff:

  -$QTDP:1:00000000004004d9:E:1:0-#a4
  +$QTDP:1:00000000004004d9:E:0:0-#a3

A related issue is that the "commands" command actually supports
setting commands to a range of breakpoints/tracepoints at once.  But,
hacking "maint info breakpoints" to print t->step_count, reveals:

 (gdb) trace main
 Tracepoint 5 at 0x45a2ab: file ../../src/gdb/gdb.c, line 29.
 (gdb) trace main
 Note: breakpoint 5 also set at pc 0x45a2ab.
 Tracepoint 6 at 0x45a2ab: file ../../src/gdb/gdb.c, line 29.
 (gdb) commands 5-6
 Type commands for breakpoint(s) 5-6, one per line.
 End with a line saying just "end".
 > while-stepping 5
  >end
 > end
 (gdb) maint info breakpoints 5
 Num     Type           Disp Enb Address            What
 5       tracepoint     keep y   0x000000000045a2ab in main at ../../src/gdb/gdb.c:29 inf 1
         step_count=5
         ^^^^^^^^^^^^
         while-stepping 5
         end
         not installed on target
 (gdb) maint info breakpoints 6
 Num     Type           Disp Enb Address            What
 6       tracepoint     keep y   0x000000000045a2ab in main at ../../src/gdb/gdb.c:29 inf 1
         step_count=0
         ^^^^^^^^^^^^
         while-stepping 5
         end
         not installed on target
 (gdb)

that tracepoint 6 doesn't end up with the correct step_count.

The issue is that here:

 static void
 do_map_commands_command (struct breakpoint *b, void *data)
 {
  struct commands_info *info = data;

  if (info->cmd == NULL)
    {
      struct command_line *l;

      if (info->control != NULL)
	l = copy_command_lines (info->control->body_list[0]);
      else
	{
	  struct cleanup *old_chain;
	  char *str;

	  str = xstrprintf (_("Type commands for breakpoint(s) "
			      "%s, one per line."),
			    info->arg);

	  old_chain = make_cleanup (xfree, str);

	  l = read_command_lines (str,
				  info->from_tty, 1,
				  (is_tracepoint (b)
				   ? check_tracepoint_command : 0),
				  b);

	  do_cleanups (old_chain);
	}

      info->cmd = alloc_counted_command_line (l);
    }

validate_actionline is never called for tracepoints other than the
first (the copy_command_lines path).  Right below, we have:

  /* If a breakpoint was on the list more than once, we don't need to
     do anything.  */
  if (b->commands != info->cmd)
    {
      validate_commands_for_breakpoint (b, info->cmd->commands);
      incref_counted_command_line (info->cmd);
      decref_counted_command_line (&b->commands);
      b->commands = info->cmd;
      observer_notify_breakpoint_modified (b);
    }

And validate_commands_for_breakpoint looks like the right place to put
a call; if we reset step_count there too, we have a nice central fix
for the first issue as well, because trace_actions_command calls
breakpoint_set_commands that also calls
validate_commands_for_breakpoint.

We end up calling validate_actionline twice for the first tracepoint,
since read_command_lines calls it too, through
check_tracepoint_command, but that should be harmless.

2013-04-04  Pedro Alves  <palves@redhat.com>
	    Hui Zhu  <hui@codesourcery.com>

	* breakpoint.c (validate_commands_for_breakpoint): If validating a
	tracepoint, reset its STEP_COUNT and call validate_actionline.

2013-04-04  Stan Shebs  <stan@codesourcery.com>
	    Pedro Alves  <palves@redhat.com>

	* gdb.trace/Makefile.in (PROGS): Add actions-changed.
	* gdb.trace/actions-changed.c: New file.
	* gdb.trace/actions-changed.exp: New file.
	* lib/trace-support.exp (gdb_trace_setactions): Rename to ...
	(gdb_trace_setactions_command): ... this.  Add "actions_command"
	parameter, and handle it.
	(gdb_trace_setactions, gdb_trace_setcommands): New procedures.
2013-04-04 19:22:38 +00:00
Yao Qi 4bd05f2493 gdb/testsuite/
* gdb.server/server-kill.exp: Use command 'tstatus' instead of
	'step'.
2013-04-04 02:16:04 +00:00
gdbadmin 9e1097d62d *** empty log message *** 2013-04-04 00:00:32 +00:00
Doug Evans bf6af49608 * dwarf2read.c (read_die_and_siblings_1): Renamed from
read_die_and_siblings.
	(read_die_and_siblings): New function.
	(read_cutu_die_from_dwo): Dump die if requested.
	(read_die_and_children): Call read_full_die_1 and
	read_die_and_siblings_1.
	(read_full_die): Dump die if requested.

	* dwarf2read.c (read_comp_units_from_section): Add debugging printf.
2013-04-03 19:45:00 +00:00
Doug Evans 0ac5b59e25 * dwarf2read.c (struct dwo_file): New member comp_dir.
Rename member name to dwo_name.  All uses updated.
	(hash_dwo_file): Include comp_dir in computation.
	(eq_dwo_file): Ditto.
	(lookup_dwo_file_slot): New arg comp_dir.  All callers updated.
	(create_dwo_in_dwp, lookup_dwo_in_dwp, open_and_init_dwo_file): Ditto.
2013-04-03 19:11:01 +00:00
Doug Evans 5ff888ce0e * psymtab.c (read_psymtabs_with_fullname): Don't call
psymtab_to_fullname if the basenames are different.
2013-04-03 18:48:54 +00:00
Jan Kratochvil ec83d2110d gdb/
* NEWS (Changes in GDB 7.6): Update the data-disassemble for "fullname".
	New entry about "fullname" presence.
2013-04-03 18:28:49 +00:00
Pedro Alves 4f4352f74d NEWS: Mention x86_64/Cygwin as new native configuration too.
x86_64/Cygwin is only mentioned as a new target, but we gained support
for building a native x86_64/Cygwin debugger too.

gdb/
2013-04-03  Pedro Alves  <palves@redhat.com>

	* NEWS: Mention x86_64/Cygwin as new native configuration.
2013-04-03 18:04:33 +00:00
Yao Qi 3758b5ce95 gdb/testsuite/
* gdb.trace/mi-traceframe-changed.exp: Update tfile name to
	"tfile-basic.tf".
	(test_tfind_tfile): Likewise.
2013-04-03 10:11:46 +00:00
Yao Qi 1dcaed0de0 gdb/testsuite/
* gdb.trace/tfile.c (write_basic_trace_file): Pass argument
	"tfile-basic.tf" instead of "basic.tf".
	(write_error_trace_file): Pass argument "tfile-error.tf"
	instead of "error.tf".
	* gdb.trace/tfile.exp: Update tfile names to
	"tfile-basic.tf" and "tfile-error.tf".
2013-04-03 03:43:54 +00:00
Sandra Loosemore 0e7a53fca6 2013-04-02 Sandra Loosemore <sandra@codesourcery.com>
gdb/testsuite/
	* gdb.cp/ovsrch.exp (test_class): Correct regexp to allow
	empty directory in file for breakpoint hit.
2013-04-03 01:40:19 +00:00
gdbadmin c38945423e *** empty log message *** 2013-04-03 00:00:32 +00:00
Doug Evans 3d1d5ea371 * dwarf2read.c (read_structure_type): Fix typo in comment. 2013-04-02 21:18:40 +00:00
Pedro Alves be9a877018 NEWS/manual: Missing documentation for new commands in 7.6.
I hacked "apropos" to dump the whole set of commands (just make it
accept the entry string as regex), and then diffed the output of 7.5
vs 7.6, --enable-targets=all builds.  That allowed then checking
whether some commands had not been mentioned in NEWS or the manual.
These are what I found missing.  We've been a bit negligent in
requiring documentation bits for debug commands.

gdb/
2013-04-02  Pedro Alves  <palves@redhat.com>

	* NEWS: Mention "set/show debug aarch64", "set/show debug
	coff-pe-read" and "set/show debug mach-o".

gdb/doc/
2013-04-02  Pedro Alves  <palves@redhat.com>

	* gdb.texinfo (Debugging Output): Document "set/show debug
	aarch64", "set/show debug coff-pe-read" and "set/show debug
	mach-o".
2013-04-02 17:52:08 +00:00
Pedro Alves a46c1e422d Add missing NEWS and manual bits for "set trace-buffer-size".
Add missing mention of the QTBuffer::size packet configuration
command, in both NEWS and manual.

gdb/
2013-04-02  Pedro Alves  <palves@redhat.com>

	* NEWS: Mention "set/show remote trace-buffer-size-packet".

gdb/doc/
2013-04-02  Pedro Alves  <palves@redhat.com>

	* gdb.texinfo (Remote Configuration) <set remote @var{name}-packet
	table>: Add entry for "trace-buffer-size".
2013-04-02 17:48:49 +00:00
Eli Zaretskii 3ad18b19d5 Fix list of files submitted to "make TAGS".
* Makefile.in (HFILES_NO_SRCDIR): Remove call-cmds.h.
	gdb_string.h is now in common/.
2013-04-02 17:44:27 +00:00
Pedro Alves e9f1758df9 NEWS: Move "set debug notification" and "set trace-buffer-size" under "New options".
The "New commands" section reads:

  "New commands (for set/show, see "New options" below)"

gdb/
2013-04-02  Pedro Alves  <palves@redhat.com>

	* NEWS: Move "set debug notification" and "set trace-buffer-size"
	under "New options".
2013-04-02 15:19:07 +00:00
Jan Kratochvil 049dc89bd7 gdb/
Revert this patch:
	PR gdb/15275
	* remote.c (remote_get_trace_status): Include putpkt in TRY_CATCH.
2013-04-02 14:09:08 +00:00
Pedro Alves c33e31fd4a unpush the remote target if serial_write fails.
PR gdb/15275 notes that when debugging with a remote connection over a
serial link and the link is disconnected, say by disconnecting USB
serial port, the GDB quit command no longer works:

 (gdb)
 tar ext /dev/ttyACM0
 &"tar ext /dev/ttyACM0\n"
 ~"Remote debugging using /dev/ttyACM0\n"
 ^done
 (gdb)
 set debug remote 1
 &"set debug remote 1\n"
 ^done
 (gdb)
 quit
 &"quit\n"
 &"Sending packet: $qTStatus#49..."
 &"putpkt: write failed: Input/output error.\n"
 ^error,msg="putpkt: write failed: Input/output error."
 (gdb)
 (gdb)
 quit
 &"quit\n"
 &"Sending packet: $qTStatus#49..."
 &"putpkt: write failed: Input/output error.\n"
 ^error,msg="putpkt: write failed: Input/output error."

This is not reproducible with TCP connections, as with that, sending
doesn't error out, but instead the error is detected on the subsequent
readchar.  When that read fails, we unpush the remote target, and
throw TARGET_CLOSE_ERROR.  To address PR gdb/15275, instead of
catching the error in remote_get_trace_status as presently done (which
leaves this same issue latent for another packet to trip on), or of
making ser-unix.c fake success too on failed writes, so we'd get to
readchar detecting the error on serial ports too, better let the error
propagate out of serial_write, and catch it at the remote.c level,
throwing away the target if writing fails too, instead of delaying
that until the next read.

gdb/
2013-04-02  Pedro Alves  <palves@redhat.com>

	PR gdb/15275

	* remote.c (send_interrupt_sequence): Use remote_serial_write.
	(remote_serial_write): New function.
	(putpkt_binary, getpkt_or_notif_sane_1): Use remote_serial_write.
2013-04-02 13:51:07 +00:00
Jiong Wang ea5f3910af gdb/ChangeLog:
* NEWS: Mention TILE-Gx in "New native configurations" and
    "New targets" sections.
2013-04-02 02:49:55 +00:00
gdbadmin 50c12e71e0 *** empty log message *** 2013-04-02 00:00:02 +00:00
Doug Evans c0f78cd41b * dwarf2read.c (lookup_signatured_type_at_offset): Delete.
(process_enumeration_scope): Simplify.
2013-04-01 23:17:40 +00:00
Doug Evans 0186c6a733 * dwarf2read.c (struct dwarf2_per_cu_data): Move member
type_unit_group ...
	(struct signatured_type): ... to here.
	(sig_type_ptr): New typedef.
	(type_unit_group): Delete member 't.first_cu'.  Move member 'tus'
	out of union 't'.  All uses updated.
	(dw2_get_file_names_reader): Assert not called for a type unit.
	(dw2_get_file_names): Assert not called for a type unit or type
	unit group.
	(build_type_psymtabs_reader): Assert called for a type unit.
	(build_type_psymtab_dependencies): Assert called for a type unit group.
2013-04-01 22:36:08 +00:00
Aleksandar Ristovski b3c0ad67f6 Fix whitespace errors from last commit. 2013-04-01 20:11:19 +00:00
Doug Evans 5c6fa7ab3b * dwarf2read.c (free_dwo_file): Add comment.
(dwarf2_per_objfile_free): Unref dwp bfd.
2013-04-01 16:42:15 +00:00
Aleksandar Ristovski cebca8c1a2 Fix coff-pe-read.c to compile with Wunused.
* coff-pe-read.c (add_pe_exported_sym): Remove unused 'dll_name_len'.
	(add_pe_forwarded_sym): Remove unused 'section', 'dll_name_len'.
	(read_pe_exported_syms): Remove unused 'exportix'.
	(pe_text_section_offset): Remove unused 'opthdr_ofs', 'num_entries',
	'export_rva', 'export_size', 'expptr', 'exp_funcbase', 'expdata',
	'erva', 'name_rvas', 'ordinals', 'nexp', 'ordbase', 'dll_name'.

	Reference: http://sourceware.org/ml/gdb-patches/2013-03/msg01081.html
2013-04-01 12:53:01 +00:00
Aleksandar Ristovski e2df15478a Cleanup: remove unused - breakpoint, buildsym
* breakpoint.c (parse_cond_to_aexpr): Remove unused 'old_chain'.
	(print_it_watchpoint): Remove unused 'bl'.
	(say_where): Remove unused 'uiout'.
	(bpstat_remove_breakpoint_callback): Remove unused 'uiout'.
	(bkpt_breakpoint_hit): Remove unused 'b'.
	(internal_bkpt_print_it): Remove unused 'uiout'.
	* buildsym.c (augment_type_symtab): Remove unused 'i'.

	Reference: http://sourceware.org/ml/gdb-patches/2013-03/msg01080.html
2013-04-01 12:48:03 +00:00
Tiago Daitx d81e75c075 gdb/ChangeLog
2013-03-01  Tiago Stürmer Daitx  <tdaitx@linux.vnet.ibm.com>

	* ppc-sysv-tdep.c (ppc64_sysv_abi_push_float): New function.
	(ppc64_sysv_abi_push_dummy_call): Handle complex arguments.
2013-04-01 04:05:35 +00:00
gdbadmin a70e0f221e *** empty log message *** 2013-04-01 00:00:32 +00:00
gdbadmin 37cf6fc121 *** empty log message *** 2013-03-31 00:00:03 +00:00
gdbadmin ab047a1e09 *** empty log message *** 2013-03-30 00:00:32 +00:00
Doug Evans ab5088bf32 * dwarf2read.c (open_dwo_file): Renamed from open_dwop_file.
Delete arg is_dwp.  All callers updated.
	(open_dwp_file): New function.
	(open_and_init_dwp_file): Call it.
	(get_dwp_file): New function.
	(lookup_dwo_cutu): Call it.
2013-03-29 21:47:51 +00:00
Doug Evans a8ad1e578d * dwarf2read.c (open_and_init_dwp_file): Remove incorrect, and
unnecessary, cleanup.
2013-03-29 21:42:04 +00:00
Doug Evans 6296d8c13f * dwarf2read.c (lookup_dwo_cutu): Improve complaint text. 2013-03-29 18:46:07 +00:00
Doug Evans b0c7bfa934 * dwarf2read.c (read_cutu_die_from_dwo): New function.
(lookup_dwo_unit): New function.
	(init_cutu_and_read_dies): Move DWO handling to new functions.
2013-03-29 17:48:48 +00:00
Doug Evans c88ee1f032 * dwarf2read.c (struct signatured_type): Tweak comment.
(struct dwo_unit): Tweak comment.
	(create_debug_types_hash_table): Tweak comment.  Reformat long line.
	(create_dwo_debug_info_hash_table): Tweak comment.
	(dwarf2_per_cu_offset_and_type): Tweak comment.
2013-03-29 16:55:57 +00:00
Doug Evans 5a8b3f62be * dwarf2read.c (lookup_signatured_type): Remove complaint about
missing .debug_types section.
2013-03-29 16:38:52 +00:00
Yao Qi 9852c492bd gdb/
2013-03-29  Yao Qi  <yao@codesourcery.com>

	* corelow.c: Include "completer.h".
	(_initialize_corelow): Call add_target_with_completer with
	argument 'filename_completer'.
	* tracepoint.c: Likewise.
	* exec.c (_initialize_exec): Likewise.
	* target.c (add_target): Rename to ...
	(add_target_with_completer): ... this.  Call set_cmd_completer
	if parameter completer is not NULL.
	(add_target): New.
	* target.h: Include "command.h".
	(add_target_with_completer): Declare it.

gdb/testsuite:

2013-03-29  Yao Qi  <yao@codesourcery.com>

	* gdb.base/completion.exp: Test completion of commands
	"target core", "target tfile" and "target exec".
	* gdb.trace/tfile.exp: Test completion of command
	"target tfile".
2013-03-29 15:21:23 +00:00
Joel Brobecker af312be731 Ignore __fu<digits>__ symbols from COFF symbol tables
The debugger sometimes prints strange function names for given
addresses. For instance, with the following source code...

	4    procedure Foo is
	5       A : Integer;
	6    begin
	7       Do_Nothing (A'Address);
	8    end Foo;

... we can see...

    (gdb) info line 5
    Line 5 of "foo.adb" starts at address 0x4017ca <_ada_foo+6>
       and ends at 0x4017d2 <_fu29__system__scalar_values__is_is4+7>.
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

_fu29__system__scalar_values__is_is4 is an artificial symbol
generated by the linker, and interferes with the pc-to-symbol
resolution.  There isn't much in the general minimal_symbol
data that could help us identify them, so this patch changes
the COFF reader to simply ignore them.

gdb/ChangeLog:

	* coffread.c (is_import_fixup_symbol): New function.
	(record_minimal_symbol): Use is_import_fixup_symbol to
	detect import fixup symbols, and discard them.

gdb/testsuite/ChangeLog:

        * gdb.ada/win_fu_syms: New testcase.
2013-03-29 02:04:15 +00:00
Doug Evans 0349ea227a * dwarf2read.c (create_debug_types_hash_table): Don't allocate the
types hash table until we know we need it.
2013-03-29 00:35:20 +00:00
Doug Evans f652bce2ee * dwarf2read.c (create_addrmap_from_index): Complain about bad CU
index numbers.
2013-03-29 00:18:32 +00:00
Doug Evans e4a48d9d49 * dwarf2read.c (dw2_get_file_names): Delete arg "objfile".
All callers updated.
	(dw2_print_stats): Print #read CUs too.
	(dump_die_shallow): Print signatured types better.

	testsuite/
	* gdb.base/maint.exp (maint print statistics): Update expected output.
2013-03-29 00:11:10 +00:00
gdbadmin 0a5a66e6ac *** empty log message *** 2013-03-29 00:00:32 +00:00
Doug Evans 8a0459fdd5 * dwarf2read.c (struct dwarf2_per_cu_data): Rename member
info_or_types_section to section.  All uses updated.
	(struct dwo_unit): Ditto.
2013-03-28 22:59:47 +00:00
Pedro Alves bd3eecc323 Stop sending qTStatus if the target doesn't recognize it; add packet configuration command.
GDB currently sends a qTStatus even if the target previously replied
an empty packet to a previous qTStatus.  If the target doesn't
recognize the packet, there's no point in trying again.

The machinery we have in place is packet_ok, which has the nice side
effect of forcing one to install a configuration command/knob for the
packet in question, which is often handy when you need to debug
things, and/or emulate a target that doesn't support the packet, or even,
it can be used as workaround for the old broken kgdb's that return error
to qTSTatus instead of an empty packet.

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

	* NEWS (New options): New section.
	(New options): Mention set/show remote trace-status-packet.
	* remote.c (PACKET_qTStatus): New enumeration value.
	(remote_get_trace_status): Skip sending qTStatus if the packet is
	disabled.  Use packet_ok.
	(_initialize_remote): Register a configuration command for
	qTStatus packet.

gdb/doc/
2013-03-28  Pedro Alves  <palves@redhat.com>

	* gdb.texinfo (Remote Configuration) <set remote @var{name}-packet
	table>: Add entry for "trace-status".
2013-03-28 21:58:03 +00:00
Eli Zaretskii 215b9f980a Fix Doug Evans's commit of 2013-03-21.
* gdb.texinfo (Maintenance Commands): Use @enumerate, not "@table
	@bullet", which is invalid (makeinfo 5.1 barfs).
2013-03-28 21:07:56 +00:00
Doug Evans 7edbb660ff * symfile.c (find_separate_debug_file): Add comment.
(terminate_after_last_dir_separator): Tweak comment.
2013-03-28 18:17:38 +00:00
Doug Evans 0018ea6f8f * dwarf2read.c (create_partial_symtab): Add forward decl.
(create_partial_symtab): Move to be closer to other psymtab functions.
	(process_psymtab_comp_unit_reader, process_psymtab_comp_unit): Ditto.
2013-03-28 17:41:03 +00:00
Doug Evans ca69b9e6ad * dwarf2read.c (dwarf2_physname): Move declaration to better spot.
(compute_symtab_includes): Remove unnecessary forward declaration.
	(die_needs_namespace): Add comment marking group of functions for
	dwarf2 name computation.
2013-03-28 17:35:01 +00:00
Doug Evans a9375afe32 * typeprint.c (_initialize_typeprint): Improve type help text. 2013-03-28 17:25:47 +00:00
Doug Evans 4124508722 * python/python.c (finish_python_initialization): Provide suggestion
for how to tell gdb to find its python files.
2013-03-28 16:39:09 +00:00
Pedro Alves 7f7cc26500 Fix PR gdb/15294: list with unlimited listsize broken
Currently, "set listsize -1" is supposed to mean "unlimited" source
lines, but, alas, it doesn't actually work:

 (gdb) set listsize -1
 (gdb) show listsize
 Number of source lines gdb will list by default is unlimited.
 (gdb) list 1
 (gdb) list 1
 (gdb) list 1
 (gdb) set listsize 10
 (gdb) list 1
 1       /* Main function for CLI gdb.
 2          Copyright (C) 2002-2013 Free Software Foundation, Inc.
 3
 4          This file is part of GDB.
 5
 6          This program is free software; you can redistribute it and/or modify
 7          it under the terms of the GNU General Public License as published by
 8          the Free Software Foundation; either version 3 of the License, or
 9          (at your option) any later version.
 10

Before this patch:

     http://sourceware.org/ml/gdb-patches/2012-08/msg00367.html

was applied, the "set listsize" command was a var_integer command, and
"unlimited" was set with 0.  Internally, var_integer maps 0 to INT_MAX

   case var_integer:
      {
      ...
	if (val == 0 && c->var_type == var_integer)
	  val = INT_MAX;

The change in that patch to zuinteger_unlimited command, meant that -1
is left as -1 in the command's control variable (lines_to_list), and
the code in source.c isn't expecting that -- it only expects positive
numbers.

I previously suggested fixing the code and keeping the new behavior,
but I found that "set listsize 0" is currently used in the wild, and
we do have a bunch of other commands where "0" means unlimited, so I'm
thinking that changing this command alone in isolation is not a good
idea.

So I now strongly prefer reverting back the behavior in 7.6 to the
same behavior the command has had since 2006 (0==unlimited, -1=error).
Before that, set listsize -1 would be accepted as unlimited as well.

After 7.6 is out, in mainline, we can get back to reconsidering
changing this command's behavior, if there's a real need for being
able to suppress output.  For now, let's play it safe.

The "list line 1 with unlimited listsize" test in list.exp was
originally written years and years ago expecting 0 to mean "no
output", but GDB never actually worked that way, even when the tests
were written, so the tests had been xfailed then.  This patch now
adjusts the test to the new behavior, so that the test actually
passes, and the xfail is removed.

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

	PR gdb/15294

	* source.c (_initialize_source): Change back "set listsize" to an
	integer command.

gdb/testsuite/
2013-03-28  Pedro Alves  <palves@redhat.com>

	PR gdb/15294

	* gdb.base/list.exp (set_listsize): Adjust to accept $arg == 0 to
	mean unlimited instead of $arg < 0.
	(test_listsize): Remove "listsize of 0 suppresses output" test.
	Test that "set listsize 0" ends up with an unlimited listsize.

gdb/doc/
2013-03-28  Pedro Alves  <palves@redhat.com>

	PR gdb/15294

	* gdb.texinfo (List) <set listsize>: Adjust to document that
	listsize 0 means no limit, and remove mention of -1.
2013-03-28 11:57:47 +00:00
Pedro Alves fc0da894a1 list.exp: Avoid hardcoding line numbers.
The previous patch actually wasn't the first time I had to update line
numbers in this file.

This avoids hard coding line numbers, hopefully making the next time a
little easier.

Tested on x86_64 Fedora 17.

gdb/testsuite/
2013-03-28  Pedro Alves  <palves@redhat.com>

	* gdb.base/list.exp (last_line): New global.
	(last_line_re): New global.
	(test_listsize, test_list_function, test_list_forward)
	(test_repeat_list_command, test_list_range)
	(test_list_filename_and_function): Use them.
	* gdb.base/list0.c: Comment the last line of the file with "last
	line".
2013-03-28 11:56:51 +00:00
Pedro Alves abe7b7116c list.exp: Adjust "set listsize -1" to current test source's real line count.
The "set listsize -1" test in list.exp can't work correct anymore
nowadays, because the test's source files grew over time, and this
particular test was never updated.

This fixes it in the obvious way.

gdb/testsuite/
2013-03-28  Pedro Alves  <palves@redhat.com>

	* gdb.base/list.exp (test_listsize): Adjust test to make sure we
	list the whole file.
2013-03-28 11:56:15 +00:00
Pedro Alves 15b3979c24 list.exp: Catch "set listsize" failures (and "set listsize -1/0"'s history).
Before the changes starting at
<http://sourceware.org/ml/gdb-patches/2012-08/msg00020.html>, the 'set
listsize' command only accepted "0" as special value, meaning
"unlimited".  The testsuite actually tried "set listsize -1" and
expected that to mean unlimited too.

If you tried testing list.exp at the time of that patch above,
you'd get:

  (gdb) PASS: gdb.base/list.exp: list line 10 with listsize 100
  set listsize 0
  (gdb) PASS: gdb.base/list.exp: setting listsize to 0 #6
  show listsize
  Number of source lines gdb will list by default is unlimited.
  (gdb) PASS: gdb.base/list.exp: show listsize unlimited #6
  list 1
  1       #include "list0.h"
  2
  ...
  42          /* Not used for anything */
  43      }
  (gdb) PASS: gdb.base/list.exp: listsize of 0 suppresses output
  set listsize -1
  integer 4294967295 out of range
  (gdb) PASS: gdb.base/list.exp: setting listsize to -1 #7
  show listsize
  Number of source lines gdb will list by default is unlimited.
  (gdb) PASS: gdb.base/list.exp: show listsize unlimited #7
  list 1
  1       #include "list0.h"

Notice that "set listsize -1" actually failed with "integer 4294967295
out of range", but we issued a PASS anyway.

(and notice how the "listsize of 0 suppresses output" test passes bogusly too.)

This patch fixes that testsuite problem in the obvious way.

gdb/testsuite/
2013-03-28  Pedro Alves  <palves@redhat.com>

	* gdb.base/list.exp (set_listsize): Use gdb_test_no_output for
	"set listsize".
2013-03-28 11:55:40 +00:00
gdbadmin da6635131b *** empty log message *** 2013-03-28 00:00:32 +00:00
Jan Kratochvil ec21308c43 gdb/
PR gdb/15275
	* remote.c (remote_get_trace_status): Include putpkt in TRY_CATCH.
2013-03-27 18:20:10 +00:00
Pedro Alves 840a9a1f86 Forbid "set history size (INT_MAX..UINT_MAX)"
The whole readline interface is signed, and works with the 0..INT_MAX
range.

We don't allow setting the size to UINT_MAX directly.  The documented
user visible interface is "use 0 for unlimited".  The UINT_MAX
representation is an implementation detail we could change, e.g., by
keeping a separate flag for "unlimited", which is actually what the
readline interface does (stifled vs non stifled).  Generically
speaking, exposing this detail to clients of the interface may make
our lives complicated when we find the need to extend the range of
some command in the future, and it's better if users
(frontends/scripts) aren't relying on anything but what we tell them
to use for "unlimited".  Making values other than 0 error out is the
way to prevent users from using those ranges inappropriately.  Quite
related, note:

    (gdb) set history size 0xffffffff
    integer 4294967295 out of range

  But,

    (gdb) set history size 0xfffffffe
    (gdb) show history size
    The size of the command history is unlimited.

    (gdb) set history size 0x100000000
    integer 4294967296 out of range

If values over INT_MAX are accepted as unlimited, then there's no good
argument for only accepting [INT_MAX..UINT_MAX) as valid "unlimited"
magic numbers, while not accepting [UINT_MAX..inf).

Making the setting's control variable of different type (unsigned int)
of the rest of the related code (int) adds the need to recall that one
variable among all these is unsigned, and that one need to think about
whether these comparisons are signed or unsigned, along with the
promotion/conversion rules.  Since this is an easy to forget detail,
this patch renames the variable to at least make it more obvious that
this variable is not one of GNU history's public int variables, which
are all signed.  We don't actually need the only code that presently
is affected by this, though, the code that is computing the current
history's length.  We can just use GNU history's history_length
instead:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Variable: int history_length
    The number of entries currently stored in the history list.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/* Return the history entry which is logically at OFFSET in the history array.
   OFFSET is relative to history_base. */
HIST_ENTRY *
history_get (offset)
     int offset;
{
  int local_index;

  local_index = offset - history_base;
  return (local_index >= history_length || local_index < 0 || the_history == 0)
		? (HIST_ENTRY *)NULL
		: the_history[local_index];
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

At the time this code was added (gdb 4.13 ~1994), 'history_length' was
extern, but not documented in readline's GNU history documents, so I
guess it wasn't considered public then and the loop was the
workaround.

One of the warts of GDB choosing 0 to mean unlimited is that "set
history size 0" behaves differently from 'HISTSIZE=0 gdb'.  The latter
leaves GDB with no history, while the former means "unlimited"...

 $ HISTSIZE=0 ./gdb
 ...
 (gdb) show history size
 The size of the command history is 0.

We shouldn't really change what HISTSIZE=0 means, as bash, etc. also
handle 0 as real zero, and zero it's what really makes sense.

gdb/
2013-03-27  Pedro Alves  <palves@redhat.com>

	* top.c (history_size): Rename to ...
	(history_size_setshow_var): ... this.  Add comment.
	(show_commands): Use readline's 'history_length' instead of
	computing the history length by calling history_get in a loop.
	(set_history_size_command): Error out for sizes over INT_MAX.
	Restore previous history size on invalid size.
	(init_history): If HISTSIZE is negative, leave the history size as
	zero.  Add comments.
	(init_main): Adjust.
2013-03-27 12:14:09 +00:00
Pedro Alves 826ecc4da3 Rename "set debug coff_pe_read" command to "set debug coff-pe-read".
Hyphens are much more common than underscores in command names.

gdb/
2013-03-27  Pedro Alves  <palves@redhat.com>

	* coff-pe-read.c (_initialize_coff_pe_read): Rename "set debug
	coff_pe_read" command to "set debug coff-pe-read".
2013-03-27 09:47:41 +00:00
Markus Metzger 0ccfeeae97 record: fix instruction-history-size regression
* record.c (command_size_to_target_size): Fix size comparison.
	Change parameter type from pointer to integer to integer.
	Update all users.
2013-03-27 09:42:47 +00:00
Pierre Muller 40653b3568 * windows-nat.c (handle_output_debug_string): Avoid typecast
from integer of different size warning.
2013-03-27 08:57:09 +00:00
Keith Seitz 96811e3b4b * gdb.base/dprintf.exp: Fix typo preventing "dprintf info 2"
from passing.
2013-03-27 05:28:57 +00:00
gdbadmin b27111f9f8 *** empty log message *** 2013-03-27 00:00:32 +00:00
Joel Brobecker c62fa0e267 windows-nat.c: Add empty line after local block variable definitions.
gdb/ChangeLog:

        * windows-nat.c (handle_output_debug_string): Add empty line
        after local block variable definition.
2013-03-26 23:40:08 +00:00
Pedro Alves 2c619be216 ser-tcp.c: Small signed->unsigned cleanup.
The "set tcp connect-timeout" variable is unsigned:

  /* Timeout period for connections, in seconds.  */

  static unsigned int tcp_retry_limit = 15;

And used like:

  /* Check for timeout.  */
  if (*polls > tcp_retry_limit * POLL_INTERVAL)
    {
      errno = ETIMEDOUT;
      return -1;
    }

Which made me stop and look over why is it that 'polls' is signed.
What I found is there's really no reason.

gdb/
2013-03-26  Pedro Alves  <palves@redhat.com>

	* ser-tcp.c (wait_for_connect): Make 'polls' parameter unsigned.
	(net_open): Make 'polls' local unsigned.
2013-03-26 20:29:47 +00:00
Pedro Alves 1b49319248 Make "set/show remoteaddresssize" a zuinteger command instead of uinteger.
It makes no sense to talk about an "unlimited" address size in this
context.

 (gdb) show remoteaddresssize
 The maximum size of the address (in bits) in a memory packet is 0.
 (gdb) set remoteaddresssize 0
 (gdb) show remoteaddresssize
 The maximum size of the address (in bits) in a memory packet is unlimited.

"set remoteaddresssize 0" mapping to UINT_MAX means you can't
force gdb through this path twice in the same GDB run:

  static CORE_ADDR
  remote_address_masked (CORE_ADDR addr)
  {
    unsigned int address_size = remote_address_size;

    /* If "remoteaddresssize" was not set, default to target address size.  */
    if (!address_size)
      address_size = gdbarch_addr_bit (target_gdbarch ());

gdb/
2013-03-26  Pedro Alves  <palves@redhat.com>

	* remote.c (_initialize_remote): Make "set remoteaddresssize"
	a zuinteger command instead of uinteger.
2013-03-26 20:19:31 +00:00
Pedro Alves 7ee70bf518 record-full.c: Remove always true checks.
The "set record full insn-number-max" command is an uinteger command.
If the variable that holds the maximum count of logged instructions is
unsigned, it's better if the variable that holds the current number of
logged instructions is also unsigned.  Looking over the code, there's
no case the variable could end up negative.

Then, tests like "if (record_full_insn_max_num)" are always true,
because being a uinteger command means that "set record full
insn-number-max 0" is actually mapped to UINT_MAX internally.  IOW,
the command's variable is never 0.  The checks might make some sense
if 0 wasn't mapped to UINT_MAX, and 0 meant unlimited, but, that's not
how things work.

Tested on x86_64 Fedora 17.

gdb/
2013-03-26  Pedro Alves  <palves@redhat.com>

	* record-full.c (record_full_insn_num): Make it unsigned.
	(record_full_check_insn_num, record_full_message)
	(record_full_registers_change, record_full_xfer_partial): Remove
	record_full_insn_max_num check (it's always != 0).
	(record_full_info, record_full_restore): Use %u as format string.
	(): Use %u as format string.
	(set_record_full_insn_max_num): Remove record_full_insn_max_num
	check (it's always != 0).
2013-03-26 20:01:03 +00:00
Pedro Alves dfd1f9bbf2 Make "set/show dcache line-size" and "set/show dcache size" zinteger commands instead of uinteger.
It doesn't make sense to request an "unlimited" dcache.  You want to
configure the cache with specific lines and length of lines.

It doesn't actually work anyway:

  (gdb) set dcache line-size 0
  Invalid dcache line size: 4294967295 (must be power of 2).

  (gdb) set dcache size 0
  (gdb) show dcache size
  Number of dcache lines is unlimited.

  (gdb) info dcache
  Dcache 4294967295 lines of 64 bytes each.
  No data cache available.

The code already has guards in place to forbid 0s:

static void
set_dcache_size (char *args, int from_tty,
		 struct cmd_list_element *c)
{
  if (dcache_size == 0)
    {
      dcache_size = DCACHE_DEFAULT_SIZE;
      error (_("Dcache size must be greater than 0."));
    }
  if (last_cache)
    dcache_invalidate (last_cache);
}

static void
set_dcache_line_size (char *args, int from_tty,
		      struct cmd_list_element *c)
{
  if (dcache_line_size < 2
      || (dcache_line_size & (dcache_line_size - 1)) != 0)
    {
      unsigned d = dcache_line_size;
      dcache_line_size = DCACHE_DEFAULT_LINE_SIZE;
      error (_("Invalid dcache line size: %u (must be power of 2)."), d);
    }
  if (last_cache)
    dcache_invalidate (last_cache);
}

So we now get:

  (gdb) set dcache line-size 0
  Invalid dcache line size: 0 (must be power of 2).
  (gdb) set dcache size 0
  Dcache size must be greater than 0.

gdb/
2013-03-26  Pedro Alves  <palves@redhat.com>

	* dcache.c (_initialize_dcache): Make the "set dcache line-size"
	and "set dcache size" commands zuinteger instead of uinteger.
2013-03-26 19:16:05 +00:00
Pedro Alves addb4faf78 Make "set/show cris-version" a zuinteger instead of uinteger.
Being a uinteger means you revert back to having GDB decide the
version.  It makes no sense to have an "unlimited" version.

  (gdb) show cris-version
  The current CRIS version is 0.
  (gdb) set cris-version 0
  (gdb) show cris-version
  The current CRIS version is unlimited.
  (gdb)

gdb/
2013-03-26  Pedro Alves  <palves@redhat.com>

	* cris-tdep.c (_initialize_cris_tdep): Make the "set cris-version"
	command zuinteger instead of uinteger.
2013-03-26 18:55:51 +00:00
Pedro Alves b75bf48806 Make "set/show debug coff_pe_read" a zuinteger instead of uinteger.
Being a uinteger means you can't disable debug output after enabling it...

  (gdb) show debug coff_pe_read
  Coff PE read debugging is 0.
  (gdb) set debug coff_pe_read 0
  (gdb) show debug coff_pe_read
  Coff PE read debugging is unlimited.
  (gdb)

gdb/
2013-03-26  Pedro Alves  <palves@redhat.com>

	* coff-pe-read.c (_initialize_coff_pe_read): Make the command
	zuinteger instead of uinteger.
2013-03-26 18:40:46 +00:00
Pedro Alves 4043f22ba5 Get rid of "No such file or directory" in the testsuite's btrace support detection.
When I tried running the btrace tests, I noticed something odd in the gdb.log file:

 (gdb) run
 Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.btrace/btrace22343.x
 Breakpoint 1, main () at /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.btrace/btrace22343.c:1
 1       /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.btrace/btrace22343.c: No such file or directory.
                                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^
 (gdb) record btrace
 Target does not support branch tracing.
 (gdb) testcase ../../../src/gdb/testsuite/gdb.btrace/enable.exp completed in 0 seconds

I knew that the btrace tests on my machine weren't supposed to work,
but still, that error made me wonder if the test had something broken,
and waste a few minutes looking up where that is coming from.

The issue is that the btrace detection deletes the source file right
after compiling it, and before GDB has a chance to open it.  It's
really harmless, but I'd rather spare others from going through the
same exercise.

We now get the regular:

 (gdb) run
 Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.btrace/btrace24210.x
 ...
 Breakpoint 1, main () at /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.btrace/btrace24210.c:1
 1       int main(void) { return 0; }
 ...

gdb/testsuite/
2013-03-26  Pedro Alves  <palves@redhat.com>

	* lib/gdb.exp (skip_btrace_tests): Delay deleting the source file
	until after GDB has run.
2013-03-26 18:26:05 +00:00
Pedro Alves 42c634cb8c "set record instruction-history-size"/"set record function-call-history-size" range validation.
While the commands are uinteger, the target interfaces are limited to
INT_MAX.  Don't let the user request more than we can handle.

gdb/
2013-03-26  Pedro Alves  <palves@redhat.com>

	* record.c (record_insn_history_size_setshow_var)
	(record_call_history_size_setshow_var): New globals.
	(command_size_to_target_size): New function.
	(cmd_record_insn_history, cmd_record_call_history): Use
	command_size_to_target_size instead of cast.
	(validate_history_size, set_record_insn_history_size)
	(set_record_call_history_size): New functions.
	(_initialize_record): Install set_record_insn_history_size and
	set_record_call_history_size as "set" hooks of "set record
	instruction-history-size" and "set record
	function-call-history-size".
2013-03-26 18:03:03 +00:00
Pedro Alves 1fb2e2b569 Use readline's 'history_max_entries' instead of the old 'max_input_history'.
Ref: http://www.sourceware.org/ml/gdb-patches/2002-08/msg00486.html

We've long since imported a newer readline, no need to use the old
compatibility variable anymore.

Tested on x86_64 Fedora 17.

gdb/
2013-03-26  Pedro Alves  <palves@redhat.com>

	* top.c (gdb_rl_operate_and_get_next): Replace max_input_history
	use with history_max_entries use.  Remove FIXME note.
2013-03-26 16:47:02 +00:00
Yao Qi 14a1aa1794 gdb/testsuite/
* gdb.trace/actions.c, gdb.trace/circ.c: Add license header.
	* gdb.trace/collection.c, gdb.trace/tfile.c: Likewise.
2013-03-26 12:46:24 +00:00
Markus Metzger 99c819eea0 record-btrace: fix assertion when enabling recording after re-run
Reading symbols from /bin/true...(no debugging symbols found)...done.
(gdb) b _start
Function "_start" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (_start) pending.
(gdb) r
Starting program: /bin/true

Breakpoint 1, 0x00000039a0400af0 in _start () from /lib64/ld-linux-x86-64.so.2
(gdb) rec b
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /bin/true

Breakpoint 1, 0x00000039a0400af0 in _start () from /lib64/ld-linux-x86-64.so.2
(gdb) rec b
gdb/record-btrace.c:154: internal-error: record_btrace_open:
 Assertion `record_btrace_thread_observer == NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)


gdb/
	* record-btrace.c (record_btrace_close): Call
	record_btrace_auto_disable.

testsuite/
	* gdb.btrace/enable.exp: Add regression test.
2013-03-26 07:15:09 +00:00
Joel Brobecker 9f9e404c04 Delete rs6000-nat.c:fixup_breakpoints extern declaration.
This function does not exist...

gdb/ChangeLog:

        * rs6000-nat.c (fixup_breakpoints): Delete declaration.
2013-03-26 00:13:08 +00:00
gdbadmin 7a4ed2f92b *** empty log message *** 2013-03-26 00:00:02 +00:00
Doug Evans ebcdfe3343 * contrib/cc-with-tweaks.sh: Check exit code of dwp. 2013-03-25 22:53:54 +00:00
Tom Tromey 24955f6344 PR symtab/11462:
* c-exp.y (exp): Add new productions for destructors after '.' and
	'->'.
	(write_destructor_name): New function.
gdb/testsuite
	* gdb.cp/m-static.exp: Add destructor-printing tests.
2013-03-25 17:28:03 +00:00
Tom Tromey fce632b6dc PR c++/9197:
* opencl-lang.c (evaluate_subexp_opencl) <STRUCTOP_STRUCT>: Use
	value_struct_elt, not lookup_struct_elt_type.
	* eval.c (evaluate_subexp_standard) <STRUCTOP_STRUCT,
	STRUCTOP_PTR>: Use value_struct_elt, not lookup_struct_elt_type.
	* expression.h (EVAL_AVOID_SIDE_EFFECTS): Update comment.
gdb/testsuite
	* gdb.cp/m-static.exp: Add constructor ptype tests.
	* gdb.cp/m-static.cc (single_constructor): New class.
	(main): Make instance of single_constructor.
2013-03-25 17:26:18 +00:00
Yao Qi a4341769f7 gdb/
* ctf.c [USE_WIN32API]: Undef 'mkdir' and use 'mkdir'
	instead of '_mkdir'.
2013-03-25 10:55:28 +00:00
gdbadmin 483cf7761d *** empty log message *** 2013-03-25 00:01:02 +00:00
gdbadmin 294c809ed2 *** empty log message *** 2013-03-24 00:00:02 +00:00
Eli Zaretskii b5981e5adf Fix relocation of directories in the MinGW build.
windows-nat.c (windows_get_absolute_argv0): New function.
 windows-nat.h: Add its prototype.
 main.c (get_init_files): Use filename_ncmp instead of strncmp.
 Use IS_DIR_SEPARATOR instead of looking for a character inside
 SLASH_STRING.  Include filenames.h.
 (captured_main) [__MINGW32__]: Make argv[0] absolute, so that
 relocate_gdb_directory works when passed gdb_program_name.
 Include windows-nat.h.
2013-03-23 10:48:23 +00:00
gdbadmin eed23bb4a1 *** empty log message *** 2013-03-23 00:00:32 +00:00
Jan Kratochvil 598d363666 gdb/
* exceptions.h (enum errors): New entry TARGET_CLOSE_ERROR.
	* remote.c (trace_error): Remove the special handling of '2'.
	(readchar) <SERIAL_EOF>
	(readchar) <SERIAL_ERROR>
	(getpkt_or_notif_sane_1): Use TARGET_CLOSE_ERROR for them.
	(remote_get_trace_status): Call throw_exception if EX is
	TARGET_CLOSE_ERROR.
	* utils.c (perror_with_name): Rename to ...
	(throw_perror_with_name): ... here.  New parameter errcode, describe it
	in the function comment.
	(perror_with_name): New function wrapper.
	* utils.h (enum errors): New stub declaration.
	(throw_perror_with_name): New declaration.

gdb/testsuite/
	* gdb.server/server-kill.c: New file.
	* gdb.server/server-kill.exp: New file.
2013-03-22 20:39:29 +00:00
Pedro Alves 82b821e99d Subject: Fix range validation of integer commands with "unlimited".
The range validation added by

  http://sourceware.org/ml/gdb-patches/2013-03/msg00767.html

Changes things to allow setting the command to INT_MAX or UINT_MAX
directly, with signed and unsigned commands respectively.  However,
that went a little bit too far, as in the cases of var_integer and
var_uinteger, those values are actually implementation detail.  It's
better to not expose them in the interface, and have users assume
those values mean "unlimited" too, so to be safer to expand the range
of the commands in the future if we want to.  Yes, it's pedantic, and
it's not likely users actually will do this, but MI frontends and
Python scripts might.

gdb/
2013-03-22  Pedro Alves  <palves@redhat.com>
	    Yao Qi  <yao@codesourcery.com>
	    Mark Kettenis  <kettenis@gnu.org>

	* cli/cli-setshow.c (do_set_command) <var_uinteger>:
	Don't let the user set the value to UINT_MAX directly.
	<var_integer>: Don't let the user set the value to INT_MAX
	directly.
2013-03-22 20:25:40 +00:00
Pedro Alves ab19f3254b Whoops, wrong patch. Reverting. 2013-03-22 20:23:58 +00:00
Pedro Alves 2ce09ced3c Subject: Fix range validation of integer commands with "unlimited".
The range validation added by

  http://sourceware.org/ml/gdb-patches/2013-03/msg00767.html

Changes things to allow setting the command to INT_MAX or UINT_MAX
directly, with signed and unsigned commands respectively.  However,
that went a little bit too far, as in the cases of var_integer and
var_uinteger, those values are actually implementation detail.  It's
better to not expose them in the interface, and have users assume
those values mean "unlimited" too, so to be safer to expand the range
of the commands in the future if we want to.  Yes, it's pedantic, and
it's not likely users actually will do this, but MI frontends and
Python scripts might.

gdb/
2013-03-22  Pedro Alves  <palves@redhat.com>
	    Yao Qi  <yao@codesourcery.com>
	    Mark Kettenis  <kettenis@gnu.org>

	* cli/cli-setshow.c (do_set_command) <var_uinteger>:
	Don't let the user set the value to UINT_MAX directly.
	<var_integer>: Don't let the user set the value to INT_MAX
	directly.
2013-03-22 20:21:48 +00:00
Jan Kratochvil 78a095c39e gdb/
* remote.c (remote_unpush_target): New function.
	(remote_open_1): Remove two pop_target calls, update one comment, add
	comment to target_preopen call.  Replace pop_target call by
	remote_unpush_target call.
	(interrupt_query, readchar, getpkt_or_notif_sane_1): Replace
	pop_target calls by remote_unpush_target calls.
2013-03-22 19:07:03 +00:00
Pedro Alves 3e74e146f2 Linux: No need to set ptrace event options in fork/clone children.
Oleg Nesterov told me that the Linux kernel copies the parent's ptrace
options to fork/clone children, so there's no need for GDB to do that
manually.

I was actually a bit surprised, since I thought the ptracer had to
always set the ptrace options itself, and GDB is indeed calling
PTRACE_SETOPTIONS for each new fork child, if it'll stay attached.

Looking at the history of that code, I found that is was actually I
who added that set-ptrace-options-in-children bit, back in
http://sourceware.org/ml/gdb-patches/2009-05/msg00656.html.  But,
honestly, I don't recall why I needed that.  I think I may have just
blindly believed it was necessary.

I then looked back at the history of all the PTRACE_SETOPTIONS code we
have, and found that gdb never did copy the ptrace options before my
patch.  But, when gdbserver learnt to use PTRACE_EVENT_CLONE, at
http://sourceware.org/ml/gdb-patches/2007-10/msg00547.html, it was
made to do 'ptrace (PTRACE_SETOPTIONS, new_pid, 0,
PTRACE_O_TRACECLONE)' for all new clones.  Hmmm.  But, GDB itself
never did that, so it can't really ever have been necessary, I
believe, otherwise GDB should have been doing it too.

(GDBserver doesn't support following forks, and so naturally doesn't
do any PTRACE_SETOPTIONS on fork children.)

So this patch removes the -I believe- unnecessary ptrace syscalls.

Tested on x86_64 Fedora 17, native/gdbserver, and on x86_64 RHEL5
native/gdbserver (Linux 2.6.18, I think a ptrace-on-utrace kernel).
No regressions.

gdb/
2013-03-22  Pedro Alves  <palves@redhat.com>

	* linux-nat.c (linux_child_follow_fork): Don't call
	linux_enable_event_reporting.
	(linux_handle_extended_wait): Don't call
	linux_enable_event_reporting.

gdb/gdbserver/
2013-03-22  Pedro Alves  <palves@redhat.com>

	* linux-low.c (handle_extended_wait): Don't call
	linux_enable_event_reporting.
2013-03-22 14:52:26 +00:00
Pedro Alves a2213dca18 hppa-hpux-tdep.c: Fix host dependency.
$ make WERROR_CFLAGS="-Wpointer-sign -Werror" hppa-hpux-tdep.o -k 2>&1 1>/dev/null
../../src/gdb/hppa-hpux-tdep.c: In function ‘hppa_hpux_push_dummy_code’:
../../src/gdb/hppa-hpux-tdep.c:1225:7: error: pointer targets in passing argument 2 of ‘write_memory’ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/hppa-hpux-tdep.c:22:0:
../../src/gdb/gdbcore.h:85:13: note: expected ‘const gdb_byte *’ but argument is of type ‘char *’
../../src/gdb/hppa-hpux-tdep.c:1251:7: error: pointer targets in passing argument 2 of ‘write_memory’ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/hppa-hpux-tdep.c:22:0:
../../src/gdb/gdbcore.h:85:13: note: expected ‘const gdb_byte *’ but argument is of type ‘char *’
../../src/gdb/hppa-hpux-tdep.c: In function ‘hppa_hpux_supply_save_state’:
../../src/gdb/hppa-hpux-tdep.c:1354:9: error: pointer targets in passing argument 1 of ‘extract_unsigned_integer’ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/hppa-hpux-tdep.c:20:0:
../../src/gdb/defs.h:675:22: note: expected ‘const gdb_byte *’ but argument is of type ‘const char *’

Casting to gdb_byte would fix it, however, writing an
unsigned int array like this

      static unsigned int hppa64_tramp[] = {
        0xeac0f000, /* bve,l (r22),%r2 */
        0x0fdf12d1, /* std r31,-8(,sp) */
        0x0fd110c2, /* ldd -8(,sp),rp */
        0xe840d002, /* bve,n (rp) */
        0x08000240  /* nop */
        ...

directly to target memory assumes the host endianness is the same as
the target's.  hppa is big endian, so I believe this patch should be
correct -- it defines the array as a gdb_byte array.  It uses a macro
to make the insn bytes a little more readable.  I thought of using
write_memory_unsigned_integer once for each element of the unsigned
int array, but this way keeps issuing a single target memory write /
roundtrip for the whole trampoline.

gdb/
2013-03-22  Pedro Alves  <palves@redhat.com>

	* hppa-hpux-tdep.c (hppa_hpux_push_dummy_code): Define INSN macro,
	use it to rewrite the trampoline buffers with type gdb_byte[], and
	undefine the macro.  Remove char* cast.
2013-03-22 14:43:28 +00:00
Yao Qi 9c0be7234d gdb/doc/
* gdb.texinfo (Embedded Processors): Remove menu item
	"OpenRISC 1000".
	(OpenRISC 1000): Remove.
2013-03-22 00:58:53 +00:00
gdbadmin 79252451d1 *** empty log message *** 2013-03-22 00:00:32 +00:00
Pedro Alves c12440c923 Fix gdb.trace/trace-buffer-size.exp race.
Just the usual missing $gdb_prompt match:

 (gdb) tstatus
 No trace has been run on the target.
 Collected 0 trace frames.
 Trace buffer has 5242880 bytes of 5242880 bytes free (0% full).
 Trace will stop if GDB disconnects.
 Not looking at any trace frame.
 PASS: gdb.trace/trace-buffer-size.exp: get default buffer size
 (gdb) set trace-buffer-size 4
 (gdb) FAIL: gdb.trace/trace-buffer-size.exp: set trace buffer size 1

This fixes it.

gdb/testsuite/
2013-03-21  Pedro Alves  <palves@redhat.com>

	* gdb.trace/trace-buffer-size.exp (get default buffer size):
	Expect $gdb_prompt in gdb_test_multiple.
2013-03-21 19:18:25 +00:00
Doug Evans bd712aed2f New commands "mt set per-command {space,time,symtab} {on,off}".
* NEWS: Add entry.
	* event-top.c: #include "maint.h".
	* main.c: #include "maint.h".
	* maint.c: #include <sys/time.h>, <time.h>, block.h, top.h,
	timeval-utils.h, maint.h, cli/cli-setshow.h.
	(per_command_time, per_command_space): New static globals.
	(per_command_symtab): New static global.
	(per_command_setlist, per_command_showlist): New static globals.
	(struct cmd_stats): Move here from utils.c.
	(set_per_command_time): Renamed from set_display_time in utils.c
	and moved here.  All callers updated.
	(set_per_command_space): Renamed from set_display_space in utils.c
	and moved here.  All callers updated.
	(count_symtabs_and_blocks): New function.
	(report_command_stats): Moved here from utils.c.  Add support for
	printing symtab stats.  Only print data if enabled before command
	executed.
	(make_command_stats_cleanup): Ditto.
	(sert_per_command_cmd, show_per_command_cmd): New functions.
	(_initialize_maint_cmds): Add new commands
	mt set per-command {space,time,symtab} {on,off}.
	* maint.h: New file.
	* top.c: #include "maint.h".
	* utils.c (reset_prompt_for_continue_wait_time): New function.
	(get_prompt_for_continue_wait_time): New function.
	* utils.h (reset_prompt_for_continue_wait_time): Declare
	(get_prompt_for_continue_wait_time): Declare.
	(make_command_stats_cleanup): Moved to maint.h.
	(set_display_time, set_display_space): Moved to maint.h and renamed
	to set_per_command_time, set_per_command_space.
	* cli/cli-setshow.c (parse_cli_boolean_value): Renamed from
	parse_binary_operation and made non-static.  Don't call error,
	just return an error marker.  All callers updated.
	* cli/cli-setshow.h (parse_cli_boolean_value): Declare.

	doc/
	* gdb.texinfo (Maintenance Commands): Add docs for
	"mt set per-command {space,time,symtab} {on,off}".

	testsuite/
	* gdb.base/maint.exp: Update tests for per-command stats.
2013-03-21 17:37:30 +00:00
Tom Tromey d76488d84e * symfile.c (alloc_section_addr_info): Update header. Don't set
'num_sections' field.
	(build_section_addr_info_from_section_table): Set 'num_sections'.
	(build_section_addr_info_from_bfd): Likewise.
	(build_section_addr_info_from_objfile): Remove dead loop
	condition.
	(free_section_addr_info): Unconditionally call xfree.
	(relative_addr_info_to_section_offsets, addrs_section_sort)
	(addr_info_make_relative, syms_from_objfile_1): Remove dead loop
	condition.
	(syms_from_objfile_1): Remove dead 'if' condition.  Check
	'num_sections'.
	(add_symbol_file_command): Set 'num_sections'.
	* symfile-mem.c (symbol_file_add_from_memory): Set
	'num_sections'.
	* somread.c (som_symfile_offsets): Remove dead loop condition.
	* machoread.c (macho_symfile_offsets): Remove dead 'if'.
	* jit.c (jit_bfd_try_read_symtab): Set 'num_sections'.
2013-03-21 16:18:48 +00:00
Tom Tromey a72e5169d6 fix date in ChangeLog entry 2013-03-21 16:16:33 +00:00
Tom Tromey 92bc6a2064 * tracepoint.h (decode_agent_options): Add 'trace_string'
argument.
	* tracepoint.c (decode_agent_options): Add 'trace_string'
	argument.
	(validate_actionline): Update.
	(collect_symbol): Add 'trace_string' argument.
	(struct add_local_symbols_data) <trace_string>: New field.
	(do_collect_symbol): Update.
	(add_local_symbols): Add 'trace_string' argument.
	(encode_actions_1): Update.
	(trace_dump_actions): Update.
	* dwarf2loc.c (access_memory): Update.
	* ax.h (struct agent_expr) <tracing, trace_string>: New fields.
	* ax-general.c (new_agent_expr): Update.
	* ax-gdb.h (gen_trace_for_expr, gen_trace_for_var)
	(gen_trace_for_return_address): Add argument.
	(trace_kludge, trace_string_kludge): Remove.
	* ax-gdb.c (trace_kludge, trace_string_kludge): Remove.
	(gen_traced_pop, gen_fetch, gen_bitfield_ref, gen_expr): Update.
	(gen_trace_for_var): Add 'trace_string' argument.
	(gen_trace_for_expr, gen_trace_for_return_address): Likewise.
	(gen_printf, agent_eval_command_one): Update.
2013-03-21 16:09:27 +00:00
Tom Tromey b2f83c0837 PR exp/15109:
* c-exp.y (yylex): Rewrite to push all tokens onto the FIFO.
	Handle FILENAME token.
gdb/testsuite
	* gdb.cp/cpexprs.exp: Add test for FILENAME:: case.
	* gdb.cp/misc.exp: Add test for FILENAME:: case.
2013-03-21 15:19:33 +00:00
Tom Tromey 9507860ea9 * c-exp.y (YYPRINT): Define.
(c_print_token): New function.
2013-03-21 15:01:55 +00:00
Tom Tromey e403aa4bf0 * c-exp.y (%union) <sym, ivar, ivec>: Remove. 2013-03-21 14:41:28 +00:00
Yao Qi af307d6a5b gdb/
* ctf.c: Include "gdb_stat.h".
	[USE_WIN32API]: New macro 'mkdir'.
	(ctf_start): Use permission bits macros if they are defined.
2013-03-21 01:08:46 +00:00
gdbadmin ad061d5d8c *** empty log message *** 2013-03-21 00:00:02 +00:00
Keith Seitz fb81d0169b * breakpoint.h (struct breakpoint): Add comment to
extra_string indicating that this member is mallod'd.
	* breakpoint.c (base_breakpoint_dtor): Free extra_string.
2013-03-20 22:17:18 +00:00
Pedro Alves ef0026f03b Fix PR gdb/15289 - "set remote hardware-watchpoint-limit" broken (zinteger commands)
This is a regression from 7.5, introduced/exposed by:
  http://sourceware.org/ml/gdb-patches/2012-07/msg00259.html

There are a series of issues with this code.

It does:

	unsigned int val = parse_and_eval_long (arg);
	^^^^^^^^^^^^

(unsigned, usually 32-bit) while parse_and_eval_long returns a LONGEST
(usually 64-bit), so we lose precision without noticing:

  (gdb) set remote hardware-watchpoint-limit 0x100000000
  (gdb) show remote hardware-watchpoint-limit 0x100000000
  The maximum number of target hardware watchpoints is 0.

While at it, print the invalid number with plongest, so the user sees
what GDB thought the number was:

  (gdb) set remote hardware-watchpoint-limit 0x100000000
  integer 4294967296 out of range

So with "set remote hardware-watchpoint-limit -1", val ends converted
to 0xffffffff, which then fails the

	else if (val >= INT_MAX)
	  error (_("integer %u out of range"), val);

test.

Looking at that INT_MAX check, we forbid INT_MAX itself, but we
shouldn't, as that does fit in 'int' -- we want to forbid values
_greater_ than INT_MAX (and less than INT_MIN, while at it):

  (gdb) set remote hardware-watchpoint-limit 2147483647
  integer 2147483647 out of range

The same problem is in the new var_zuinteger_unlimited code, which
also uses "int" for variable.

Also, when printing a 'signed int', we should use %d, not %u.

This adds a couple regression tests.  Not completely thorough in checking
all kinds of invalid input; I'm saving more exaustive testing around
zXXinteger commands for something like new test-assisting commands
like "maint test cmd-zinteger -1", where testing would focus on the
command types, and thus be independent of particular user commands of
particular GDB features.

Tested on x86_64 Fedora 17.

gdb/
2013-03-20  Pedro Alves  <palves@redhat.com>

	PR gdb/15289

	* cli/cli-setshow.c (do_set_command)
	<var_uinteger, var_zuinteger>: Use LONGEST for variable holding
	the result of parsing the command argument.  Throw error if the
	value is greater than UINT_MAX.  Print the invalid value with
	plongest.
	<var_integer, var_zinteger>: Use LONGEST for variable holding the
	result of parsing the command argument.  Throw error if the value
	is greater than INT_MAX, not greater or equal.  Also throw error
	if the value is less than INT_MIN.  Print the invalid value with
	plongest.
	<var_zuinteger_unlimited>: Throw error if the value is greater
	than INT_MAX, not greater or equal.
	(do_show_command) <var_integer, var_zinteger,
	var_zuinteger_unlimited>: Use %d for printing int, not %u.

gdb/testsuite/
2013-03-20  Pedro Alves  <palves@redhat.com>

	PR gdb/15289

	* gdb.base/remote.exp: Test
	"set remote hardware-watchpoint-limit -1",
	"set remote hardware-breakpoint-limit -1",
	"set remote hardware-watchpoint-limit 2147483647" and
	"set remote hardware-breakpoint-limit 2147483647".
2013-03-20 18:58:16 +00:00
Tom Tromey 24d6c2a0bb * ax-gdb.c (gen_var_ref): Unconditionally call via computed ops,
if possible.
	* dwarf2read.c (read_func_scope): Remove old FIXME.
	* eval.c (evaluate_subexp_standard): Check SYMBOL_COMPUTED_OPS,
	not LOC_COMPUTED.
	* findvar.c (symbol_read_needs_frame, default_read_var_value):
	Unconditionally call via computed ops, if possible.
	* printcmd.c (address_info): Unconditionally call via computed ops,
	if possible.
	* stack.c (read_frame_arg): Unconditionally call via computed ops,
	if possible.
	* symtab.c (register_symbol_computed_impl): Sanity check 'ops'.
	* tracepoint.c (scope_info): Unconditionally call via computed ops,
	if possible.
2013-03-20 18:35:22 +00:00
Tom Tromey f1e6e0721c 2013-03-20 Jan Kratochvil <jan.kratochvil@redhat.com>
Tom Tromey  <tromey@redhat.com>

	PR symtab/8421:
	* coffread.c (coff_register_index): New global.
	(process_coff_symbol, coff_read_enum_type): Set
	SYMBOL_ACLASS_INDEX.
	(_initialize_coffread): Initialize new global.
	* dwarf2loc.c (locexpr_find_frame_base_location)
	(dwarf2_block_frame_base_locexpr_funcs)
	(loclist_find_frame_base_location)
	(dwarf2_block_frame_base_loclist_funcs): New.
	(dwarf_expr_frame_base_1): Call SYMBOL_BLOCK_OPS, remove internal_error.
	(dwarf2_locexpr_funcs, dwarf2_loclist_funcs): Add location_has_loclist.
	* dwarf2loc.h (dwarf2_block_frame_base_locexpr_funcs)
	(dwarf2_block_frame_base_loclist_funcs): New.
	* dwarf2read.c (dwarf2_locexpr_index, dwarf2_loclist_index)
	(dwarf2_locexpr_block_index, dwarf2_loclist_block_index): New
	globals.
	(read_func_scope): Update.
	(fixup_go_packaging, mark_common_block_symbol_computed)
	(var_decode_location, new_symbol_full, dwarf2_const_value):
	Set SYMBOL_ACLASS_INDEX.
	(dwarf2_symbol_mark_computed): Likewise.  Add 'is_block' argument.
	(_initialize_dwarf2_read): Initialize new globals.
	* jit.c (finalize_symtab): Set SYMBOL_ACLASS_INDEX.
	* jv-lang.c (add_class_symbol): Set SYMBOL_ACLASS_INDEX.
	* mdebugread.c (mdebug_register_index, mdebug_regparm_index): New
	globals.
	(parse_symbol, psymtab_to_symtab_1): Set SYMBOL_ACLASS_INDEX.
	(_initialize_mdebugread): Initialize new globals.
	* psympriv.h (struct partial_symbol) <aclass>: Update comment.
	* stabsread.c (patch_block_stabs): Set SYMBOL_ACLASS_INDEX.
	(stab_register_index, stab_regparm_index): New globals.
	(define_symbol, read_enum_type, common_block_end): Set
	SYMBOL_ACLASS_INDEX.
	(_initialize_stabsread): Initialize new globals.
	* symtab.c (next_aclass_value, symbol_impl, symbol_impls): New
	globals.
	(MAX_SYMBOL_IMPLS): New define.
	(register_symbol_computed_impl, register_symbol_block_impl)
	(register_symbol_register_impl)
	(initialize_ordinary_address_classes): New functions.
	(_initialize_symtab): Call initialize_ordinary_address_classes.
	* symtab.h (enum address_class) <LOC_FINAL_VALUE>: New constant.
	(struct symbol_impl): New.
	(SYMBOL_ACLASS_BITS): New define.
	(struct symbol) <aclass, ops>: Remove fields.
	<aclass_index>: New field.
	(symbol_impls): Declare.
	(SYMBOL_CLASS, SYMBOL_COMPUTED_OPS, SYMBOL_REGISTER_OPS): Redefine.
	(SYMBOL_IMPL, SYMBOL_ACLASS_INDEX): New defines.
	(register_symbol_computed_impl, register_symbol_block_impl)
	(register_symbol_register_impl): Declare.
	(struct symbol_computed_ops): Add location_has_loclist.
	(struct symbol_block_ops): New.
	(SYMBOL_BLOCK_OPS): New.
	* xcoffread.c (process_xcoff_symbol): Set SYMBOL_ACLASS_INDEX.
2013-03-20 18:33:05 +00:00
Tom Tromey dbccfd4c96 * psymtab.c (find_pc_sect_psymbol, fixup_psymbol_section)
(print_partial_symbols, recursively_search_psymtabs): Use
	PSYMBOL_CLASS.
2013-03-20 18:28:48 +00:00
Pierre Muller e3f1ad4fd2 * contrib/ari/gdb_ari.sh (OP eol rule): Also check
addtion, subtraction, multiplication and division binary operator.
2013-03-20 16:13:10 +00:00
Jan Kratochvil 460014f572 gdb/
Code cleanup.
	* bfd-target.c (target_bfd_xclose): Remove parameter quitting.
	* bsd-kvm.c (bsd_kvm_close): Likewise.
	* bsd-uthread.c (bsd_uthread_close): Likewise.
	* corelow.c (core_close): Likewise.
	(core_close_cleanup): Remove parameter quitting from a caller.
	* event-top.c (async_disconnect): Likewise.
	* exec.c (exec_close_1): Remove parameter quitting.
	* go32-nat.c (go32_close): Likewise.
	* linux-nat.c (linux_nat_close): Remove parameter quitting.  Remove
	parameter quitting from a caller.
	* mips-linux-nat.c (super_close): Remove parameter quitting from the
	variable.
	(mips_linux_close): Remove parameter quitting.  Remove parameter
	quitting from a caller.
	* monitor.c (monitor_close): Remove parameter quitting.
	* monitor.h (monitor_close): Likewise.
	* record-btrace.c (record_btrace_close): Likewise.
	* record-full.c (record_full_close): Likewise.
	* remote-m32r-sdi.c (m32r_close): Remove parameter quitting and remove
	it also from fprintf_unfiltered.
	* remote-mips.c (mips_close): Remove parameter quitting.
	(mips_detach): Remove parameter quitting from a caller.
	* remote-sim.c (gdbsim_close): Remove parameter quitting.
	(gdbsim_close): Remove duplicate function comment.  Remove parameter
	quitting and remove it also from printf_filtered.
	* remote.c (remote_close): Remove parameter quitting.
	* solib-svr4.c (enable_break): Remove parameter quitting from a caller.
	* target.c (update_current_target): Remove parameter int from to_close
	de_fault.
	(push_target, unpush_target, pop_target): Remove parameter quitting from
	a caller.
	(pop_all_targets_above, pop_all_targets): Remove parameter quitting.
	Remove parameter quitting from a caller.
	(target_preopen): Remove parameter quitting from a caller.
	(target_close): Remove parameter quitting.  Remove parameter quitting
	from a caller two times.  Remove parameter quitting also from
	fprintf_unfiltered.
	* target.h (struct target_ops): Remove parameter quitting and as int
	from fields to_xclose and to_close.
	(extern struct target_ops current_target):
	(target_close, pop_all_targets): Remove parameter quitting.  Update the
	comment.
	(pop_all_targets_above): Remove parameter quitting.
	* top.c (quit_target): Remove parameter quitting from a caller.
	* tracepoint.c (tfile_close): Remove parameter quitting.
	* windows-nat.c (windows_close): Remove parameter quitting.
2013-03-20 15:46:24 +00:00