Commit Graph

32392 Commits

Author SHA1 Message Date
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
Pedro Alves 3f1175a995 tfile.exp: Test printing a non-const global that is not covered by the trace frame; test disassembling.
Make sure we don't fallback to printing the initial value of a
non-const variable in the executable.

Also make sure we can do 'disassemble', as another test that GDB is
able to read read-only parts from the executable (the existing test of
printing constglob also covers that case).

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

	* gdb.trace/tfile.c: Add comments.
	(nonconstglob): New global.
	* gdb.trace/tfile.exp: Add comments.  Test printing a non-const
	global that is not covered by the trace frame.  Test
	disassembling.
2013-03-20 11:28:55 +00:00
Corinna Vinschen 35a7120b8c * windows-nat.c (handle_output_debug_string): Replace call
to string_to_core_addr with call to strtoull.
2013-03-20 08:51:06 +00:00
Yao Qi 8249a5a9e2 gdb/
* ctf.c (ctf_save_metadata_header): Define macro HOST_ENDIANNESS
	and write it to CTF metadata.
2013-03-20 02:54:22 +00:00
gdbadmin e5e21fa801 *** empty log message *** 2013-03-20 00:00:02 +00:00
Corinna Vinschen 2c15ef432f * windows-nat.c (handle_output_debug_string): Change type of n to
SIZE_T to avoid crash on 64 bit systems.
2013-03-19 15:06:26 +00:00
gdbadmin e7579b60ca *** empty log message *** 2013-03-19 11:00:32 +00:00
gdbadmin f7f9535d8d *** empty log message *** 2013-03-18 00:00:34 +00:00
Jan Kratochvil a09ae1c1e8 gdb/testsuite/
* gdb.base/valgrind-infcall.exp
	(continue #$continue_count) <remote connection closed>
	(continue #$continue_count) <valgrind vgdb has terminated>: Add kill of
	$valgrind_pid.
2013-03-17 20:37:32 +00:00
Eli Zaretskii 1cdd32326f Avoid MinGW warnings about redefinition of snprintf.
gdb/python/python-internal.h (HAVE_SNPRINTF)
 [_WIN32 && HAVE_DECL_SNPRINTF]: Define, to avoid compiler warnings
 about redefinition of snprintf by pyerrors.h.
2013-03-17 19:10:38 +00:00
gdbadmin 5f7b875afe *** empty log message *** 2013-03-17 00:00:34 +00:00
gdbadmin 584b3f2565 *** empty log message *** 2013-03-16 00:00:03 +00:00
Steve Ellcey 3cb2ab1a46 gdb:
2013-03-15  Steve Ellcey  <sellcey@mips.com>

	* remote-sim.c (sim_command_completer): Make char arguments const.

include:


2013-03-15  Steve Ellcey  <sellcey@mips.com>

	* gdb/remote-sim.h (sim_command_completer): Make char arguments const.

sim:

2013-03-15  Steve Ellcey  <sellcey@mips.com>

	* arm/wrapper.c (sim_complete_command): Make char arguments const.
	* avr/interp.c (sim_complete_command): Ditto.
	* common/sim-options.c (sim_complete_command): Ditto.
	* cr16/interp.c (sim_complete_command): Ditto.
	* erc32/interf.c (sim_complete_command): Ditto.
	* m32c/gdb-if.c (sim_complete_command): Ditto.
	* microblaze/interp.c (sim_complete_command): Ditto.
	* ppc/sim_calls.c (sim_complete_command): Ditto.
	* rl78/gdb-if.c (sim_complete_command): Ditto.
	* rx/gdb-if.c (sim_complete_command): Ditto.
	* sh/interp.c (sim_complete_command): Ditto.
2013-03-15 17:53:44 +00:00
Tom Tromey a8347a2acd 2013-03-15 Tony Theodore <tonyt@logyst.com>
PR build/9098:
	* Makefile.in (SHELL): Use @SHELL@.
2013-03-15 17:30:27 +00:00
Tom Tromey 9ce986499e PR c++/15116:
* gdbtypes.c (types_equal): Handle TYPE_CODE_FUNC.
gdb/testsuite
    	* gdb.cp/overload.cc (intintfunc): New.
    	* gdb.cp/overload.exp: Add regression test.
2013-03-15 17:10:45 +00:00
Yao Qi 0a251e08fa gdb/testsuite/
* gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of
	using with_test_prefix.
	* gdb.threads/non-ldr-exc-2.exp (do_test): Likewise.
	* gdb.threads/non-ldr-exc-3.exp (do_test): Likewise.
	* gdb.threads/non-ldr-exc-4.exp (do_test): Likewise.
	* gdb.threads/watchpoint-fork.exp (test): Likewise.
	* gdb.base/break-interp.exp (test_core): Likewise.
	(test_attach_gdb): Likewise.
	* gdb.base/catch-load.exp (one_catch_load_test): Likewise.
	* gdb.base/disp-step-syscall.exp (disp_step_cross_syscall):
	Likewise.
	* gdb.base/jit-so.exp (one_jit_test): Likewise.
	* gdb.base/jit.exp (one_jit_test): Likewise.
	* gdb.base/sepdebug.exp (test_different_dir): Likewise.
	* gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise.
	* gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise.
	* gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved):
	Likewise.
	* gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed):
	Likewise.
	* gdb.mi/mi-watch.exp test_watchpoint_all): Likewise.
	* gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise.
	* gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise.
	(tracepoint_change_loc_2): Likewise.
	* gdb.trace/disconnected-tracing.exp (disconnected_tracing):
	Likewise.
	(disconnected_tfind): Likewise.
	* gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile):
	Likewise.
	(test_tfind_remote): Likewise.
	* gdb.trace/mi-tracepoint-changed.exp (test_reconnect):
	Likewise.
	(test_pending_resolved): Likewise.
	* gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv):
	Likewise.
	(test_upload_tsv): Likewise.
	* gdb.trace/pending.exp (pending_tracepoint_resolved):
	Likewise.
	(pending_tracepoint_works): Likewise.
	* gdb.trace/report.exp (use_collected_data): Likewise.
	* gdb.trace/status-stop.exp (test_tstart_tstop_tstart):
	Likewise.
	(test_tstart_tstart, test_buffer_full_tstart): Likewise.
	* gdb.trace/strace.exp (strace_info_marker): Likewise.
	(strace_trace_on_same_addr): Likewise.
	(strace_trace_on_diff_addr): Likewise.
	* gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise.
	(gdb_collect_locals_test): Likewise.
	(gdb_unavailable_registers_test): Likewise.
	(gdb_collect_globals_test): Likewise.
2013-03-15 01:41:29 +00:00
Yao Qi 2c415c0f38 gdb/testsuite/
* gdb.base/condbreak.exp: Add semicolon back which was removed
	by my previous commit.
2013-03-15 01:33:40 +00:00
gdbadmin 461103507e *** empty log message *** 2013-03-15 00:00:32 +00:00
Tom Tromey dccee2de16 * gdb_bfd.c (struct gdb_bfd_data) <crc_computed, crc>:
New fields.
	(get_file_crc): Move from symfile.c.
	(gdb_bfd_crc): New function.
	* gdb_bfd.h (gdb_bfd_crc): Declare.
	* objfiles.h (struct objfile) <crc32, crc32_p>: Remove.
	* symfile.c (get_file_crc): Move to gdb_bfd.c.
	(separate_debug_file_exists): Use gdb_bfd_crc.
2013-03-14 20:26:19 +00:00
Tom Tromey cc0ea93c75 gdb
* symfile.c (get_debug_link_info): Remove.
	(find_separate_debug_file_by_debuglink): Use
	bfd_get_debug_link_info.
bfd
	* opncls.c (bfd_get_debug_link_info): Rename from
	get_debug_link_info.  Export.  Update comment.
	(find_separate_debug_file): Update.
	* bfd-in2.h: Rebuild.
2013-03-14 20:11:12 +00:00
Tom Tromey 08c23b0d0f * symtab.c (error_in_psymtab_expansion): New function.
(lookup_symbol_aux_quick)
	(basic_lookup_transparent_type_quick): Remove "last resort"
	code.  Use error_in_psymtab_expansion.
2013-03-14 18:56:02 +00:00
Jan Kratochvil 288e77a7ac gdb/
* dwarf2read.c (dw2_map_symtabs_matching_filename): Put continue after
	any successful compare_filenames_for_search or FILENAME_CMP.
	* psymtab.c (partial_map_symtabs_matching_filename): Likewise.
	* symtab.c (iterate_over_some_symtabs): Likewise.
2013-03-14 16:36:27 +00:00
Jan Kratochvil 8f1b8b820d gdb/
* source.c (print_source_lines_base): Make a local copy of
	symtab_to_fullname.
2013-03-14 14:42:48 +00:00
Jan Kratochvil 23eb71e428 gdb/
* source.c (print_source_lines_base): Suppress "file" for TUI.
2013-03-14 14:35:17 +00:00
Yao Qi ae59b1da21 gdb/testsuite/
* config/monitor.exp (gdb_target_cmd): Remove semicolon after
	'return'.
	(gdb_target_monitor, gdb_load): Likewise.
	* config/sid.exp (gdb_load): Likewise.
	* config/slite.exp (gdb_load): Likewise.
	* config/vx.exp (gdb_start, spawn_vxgdb): Likewise.
	* gdb.ada/arrayidx.exp, gdb.ada/null_array.exp: Likewise.
	* gdb.arch/mips-octeon-bbit.exp (single_step): Likewise.
	(single_step_until): Likewise.
	* gdb.arch/powerpc-d128-regs.exp: Likewise.
	* gdb.arch/system-gcore.exp: Likewise.
	* gdb.base/bigcore.exp (extract_heap): Likewise.
	* gdb.base/break-on-linker-gcd-function.exp: Likewise.
	* gdb.base/call-ar-st.exp: Likewise.
	* gdb.base/call-rt-st.exp: Likewise.
	* gdb.base/call-sc.exp, gdb.base/call-strs.exp: Likewise.
	* gdb.base/callfuncs.exp, gdb.base/completion.exp: Likewise.
	* gdb.base/condbreak.exp, gdb.base/constvars.exp: Likewise.
	* gdb.base/corefile.exp: Likewise.
	* gdb.base/dbx.exp (gdb_file_cmd): Likewise.
	* gdb.base/exprs.exp, gdb.base/fileio.exp: Likewise.
	* gdb.base/fixsection.exp: Likewise.
	* gdb.base/funcargs.exp: Likewise.
	* gdb.base/gcore-buffer-overflow.exp: Likewise.
	* gdb.base/gcore-relro.exp: Likewise.
	* gdb.base/gcore.exp, gdb.base/gdb11530.exp: Likewise.
	* gdb.base/gdb11531.exp, gdb.base/gnu-ifunc.exp: Likewise.
	* gdb.base/info-os.exp, gdb.base/info-proc.exp: Likewise.
	* gdb.base/interp.exp, gdb.base/langs.exp:: Likewise.
	* gdb.base/list.exp: Likewise.
	(set_listsize): Likewise.
	* gdb.base/logical.exp, gdb.base/mips_pro.exp: Likewise.
	* gdb.base/miscexprs.exp, gdb.base/nodebug.exp: Likewise.
	* gdb.base/opaque.exp, gdb.base/pointers.exp: Likewise.
	* gdb.base/psymtab.exp, gdb.base/ptype.exp: Likewise.
	* gdb.base/relational.exp, gdb.base/scope.exp: Likewise.
	* gdb.base/setvar.exp: Likewise.
	(test_set): Likewise.
	* gdb.base/signals.exp, gdb.base/sizeof.exp: Likewise.
	* gdb.base/solib-overlap.exp: Likewise.
	* gdb.base/store.exp, gdb.base/structs.exp: Likewise.
	* gdb.base/structs2.exp, gdb.base/volatile.exp: Likewise.
	* gdb.base/watchpoint.exp (initialize): Likewise.
	(test_simple_watchpoint): Likewise.
	(test_disabling_watchpoints): Likewise.
	(test_watchpoint_triggered_in_syscall): Likewise.
	* gdb.base/whatis.exp, gdb.cp/ambiguous.exp: Likewise.
	* gdb.cp/casts.exp, gdb.cp/ctti.exp: Likewise.
	* gdb.cp/namespace.exp, gdb.cp/nsdecl.exp: Likewise.
	* gdb.cp/psmang.exp, gdb.dwarf2/dw2-ranges.exp: Likewise.
	* gdb.hp/gdb.aCC/optimize.exp: Likewise.
	* gdb.hp/gdb.aCC/watch-cmd.exp: Likewise.
	* gdb.hp/gdb.base-hp/callfwmall.exp: Likewise.
	* gdb.hp/gdb.base-hp/pxdb.exp: Likewise.
	* gdb.hp/gdb.compat/xdb1.exp: Likewise.
	* gdb.hp/gdb.compat/xdb2.exp: Likewise.
	* gdb.hp/gdb.compat/xdb3.exp: Likewise.
	* gdb.hp/gdb.defects/bs14602.exp: Likewise.
	* gdb.hp/gdb.defects/solib-d.exp: Likewise.
	* gdb.mi/gdb792.exp: Likewise.
	* gdb.mi/mi-inheritance-syntax-error.exp: Likewise.
	* gdb.mi/mi-logging.exp, gdb.mi/mi-var-cp.exp : Likewise.
	* gdb.mi/mi-var-rtti.exp, gdb.python/py-type.exp: Likewise.
	* gdb.threads/gcore-thread.exp: Likewise.
	(load_core): Likewise.
	* gdb.threads/pthreads.exp (all_threads_running): Likewise.
	(test_startup, check_control_c): Likewise.
	* gdb.threads/sigstep-threads.exp: Likewise.
	* gdb.threads/thread_check.exp: Likewise.
	* gdb.trace/backtrace.exp, gdb.trace/change-loc.exp: Likewise.
	* gdb.trace/circ.exp (run_trace_experiment): Likewise.
	(set_a_tracepoint, trace_buffer_normal): Likewise.
	(gdb_trace_circular_tests): Likewise.
	* gdb.trace/collection.exp: Likewise.
	* gdb.trace/disconnected-tracing.exp: Likewise.
	* gdb.trace/infotrace.exp: Likewise.
	* gdb.trace/mi-traceframe-changed.exp: Likewise.
	* gdb.trace/mi-tracepoint-changed.exp: Likewise.
	* gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise.
	* gdb.trace/packetlen.exp, gdb.trace/passc-dyn.exp: Likewise.
	* gdb.trace/pending.exp, gdb.trace/report.exp: Likewise.
	* gdb.trace/stap-trace.exp: Likewise.
	* gdb.trace/status-stop.exp,gdb.trace/strace.exp: Likewise.
	* gdb.trace/tfind.exp, gdb.trace/trace-break.exp: Likewise.
	* gdb.trace/trace-buffer-size.exp: Likewise.
	* gdb.trace/tspeed.exp, gdb.trace/tsv.exp: Likewise.
	* gdb.trace/unavailable.exp: Likewise.
	* gdb.trace/while-dyn.exp: Likewise.
	* lib/fortran.exp (set_lang_fortran): Likewise.
	* lib/gdb.exp (default_gdb_version, gdb_start_cmd): Likewise.
	(gdb_breakpoint, gdb_reinitialize_dir): Likewise.
	(default_gdb_start, get_compiler_info): Likewise.
	(gdb_compile, gdb_compile_objc, gdb_reload, gdb_init): Likewise.
	(get_debug_format, setup_xfail_format): Likewise.
	(rerun_to_main, gdb_skip_float_test): Likewise.
	(build_id_debug_filename_get, get_remotetimeout): Likewise.
	* lib/java.exp (set_lang_java): Likewise.
	* lib/mi-support.exp (default_mi_gdb_start): Likewise.
	(mi_gdb_reinitialize_dir, mi_gdb_target_cmd): Likewise.
	(mi_gdb_file_cmd, mi_gdb_test): Likewise.
	(mi_run_cmd_full, mi_expect_interrupt): Likewise.
	* lib/objc.exp (set_lang_objc): Likewise.
	* lib/pascal.exp (set_lang_pascal): Likewise.
	* lib/prompt.exp (default_prompt_gdb_start): Likewise.
	* lib/trace-support.exp (gdb_trace_setactions, gdb_tfind_test): Likewise.
	(gdb_readexpr, gdb_gettpnum, gdb_find_recursion_test_baseline): Likewise.
2013-03-14 13:34:06 +00:00
Sergio Durigan Junior eeb56fa757 2013-03-14 Sergio Durigan Junior <sergiodj@redhat.com>
* tracepoint.c (cmd_qtv): Initialize `val' with zero, silencing
	compiler warning.
2013-03-14 11:40:08 +00:00
Sergio Durigan Junior bb869963da From: Sergio Durigan Junior <sergiodj@redhat.com>
Subject: [PATCH] Fix for PR c++/15203 and PR c++/15210
Date: Sat, 09 Mar 2013 02:50:49 -0300 (5 days, 4 hours, 57 minutes ago)
Message-ID: <m3a9qdnmti.fsf@redhat.com>

Hi,

This bug was reported internally at our Bugzilla, along with a proposed
fix.  After talking to Keith about it, he investigated and came up with
another patch needed to really fix the issue on CVS HEAD.

The first part of the fix is the patch to cp-namespace.c.  It handles
the case when we are accessing a static variable inside a function
(inside a class) by the full linespec (is it right, Keith?).  E.g.:

    class foo
    {
    public:
        int bar()
        {
            static int var = 0;
        }
    };

And then, printing the value of `var':

    (gdb) print 'foo::bar()::var'

GDB would fall in an internal_error:

    gdb/cp-namespace.c:816: internal-error: cp_lookup_nested_symbol called on a non-aggregate type.

This is because `cp_lookup_nested_symbol' is not handling the case when
TYPE_CODE is either _FUNC or _METHOD.  This patch fixes it by returning
NULL in this case.

The second part of the fix is the patch to elfread.c.  It is needed
because the BSF_GNU_UNIQUE flag was added to some symbols in
<http://sourceware.org/ml/binutils/2009-06/msg00016.html>.  Because of
that, (still) the command:

    (gdb) print 'foo::bar()::var'

where `var' is a static variable returns:

    "No symbol "foo::bar()::var" in current context."

So with the second patch applied the command finally DTRT:

    (gdb) print 'foo::bar()::var'
    $1 = 0

This may not be the ideal solution, according to Keith it would be good
to implement productions on c-exp.y in order to recognize
CLASS::FUNCTION::VARIABLE, but it is a solution which works with what we
have today.

I regtested it in Fedora 17 x86_64 with -m64 and -m32, including
gdbserver, without regressions.

gdb/:
2013-03-14  Keith Seitz  <keiths@redhat.com>
	    Alan Matsuoka  <alanm@redhat.com>

	PR c++/15203
	PR c++/15210
	* cp-namespace.c (cp_lookup_nested_symbol): Handle TYPE_CODE_FUNC and
	TYPE_CODE_METHOD.
	* elfread.c (elf_symtab_read): Handle BSF_GNU_UNIQUE for certain
	symbols.

gdb/testsuite/:
2013-03-14  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR c++/15203
	PR c++/15210
	* gdb.cp/m-static.cc (keepalive_int): New function.
	(gnu_obj_1::method): New variable `sintvar', call `keepalive_int'.
	* gdb.cp/m-static.exp: New test for `sintvar'.
2013-03-14 11:13:36 +00:00
Yao Qi e2be70a0e1 gdb/testsuite/
* gdb.trace/tstatus.exp (run_trace_experiment): Save the output
	of 'tstatus' into tstatus_output.
	(top level): Save the trace data to tfile.  Read trace file in
	tfile target.  Check the trace status.
2013-03-14 09:12:21 +00:00
Yao Qi d6682f9ee9 gdb/
* tracepoint.c (tfile_write_status): Write 'stop_desc' of trace
	status to tfile if trace is stopped by command 'tstop'.
2013-03-14 09:08:56 +00:00
Yao Qi a22fa6e48d gdb/
* tracepoint.c (tfile_write_status): Write trace notes and user
	name into tfile if they are not NULL.
2013-03-14 09:06:40 +00:00
Yao Qi d0353e7691 gdb/
2013-03-14  Hui Zhu  <hui@codesourcery.com>
	    Yao Qi  <yao@codesourcery.com>

	* Makefile.in (REMOTE_OBS): Add ctf.o.
	(SFILES): Add ctf.c.
	(HFILES_NO_SRCDIR): Add ctf.h.
	* ctf.c, ctf.h: New files.
	* tracepoint.c: Include 'ctf.h'.
	(collect_pseudocommand): Remove static.
	(trace_save_command): Parse option "-ctf".
	Produce different trace file writers per option.
	Adjust output message.
	(trace_save_tfile, trace_save_ctf): New.
	* tracepoint.h (trace_save_tfile, trace_save_ctf): Declare.
	* mi/mi-main.c: Include 'ctf.h'.
	(mi_cmd_trace_save): Handle option '-ctf'.  Call either
	trace_save_tfile or trace_save_ctf.
	* NEWS: Mention these changes.

gdb/doc/
2013-03-14  Hui Zhu  <hui@codesourcery.com>
	    Yao Qi  <yao@codesourcery.com>

	* gdb.texinfo (Trace Files): Add "tsave -ctf".
2013-03-14 09:02:30 +00:00
Yao Qi 3f43bc09fa gdb/
* tracepoint.c (trace_file_writer_xfree): New.
	(struct tfile_writer_data): New.
	(tfile_dtor, tfile_can_target_save, tfile_start): New.
	(tfile_write_header, tfile_write_regblock_type): New.
	(tfile_write_status, tfile_write_uploaded_tsv): New.
	(tfile_write_uploaded_tp, tfile_write_definition_end): New.
	(tfile_write_raw_data, (tfile_end): New.
	(tfile_write_ops): New global variable.
	(TRACE_WRITE_R_BLOCK): New macro.
	(TRACE_WRITE_M_BLOCK_HEADER): New macro.
	(TRACE_WRITE_M_BLOCK_MEMORY): New macro.
	(TRACE_WRITE_V_BLOCK): New macro.
	(trace_save): Add extra one parameter WRITER.  Make it static.
	Use WRITER to writer trace.
	(tfile_trace_file_writer_new): New.
	(trace_save_command): Caller update.
	(trace_save_tfile): Write trace data in TFILE format.
	* tracepoint.h (struct trace_frame_write_ops): New.
	(struct trace_file_write_ops): New.
	(struct trace_file_writer): New.
	(trace_save): Remove its declaration.
	(trace_save_tfile): Declare it.
	* mi/mi-main.c (mi_cmd_trace_save): Call trace_save_tfile
	instead of trace_save.
2013-03-14 08:50:55 +00:00
gdbadmin 70ef316113 *** empty log message *** 2013-03-14 00:00:34 +00:00
Pedro Alves 58665b4094 Make hppa-hpux-nat.c:hppa_hpux_save_state_offset static.
Dave reports:

> There is one small (...) issue that needs fixing:
>
> gcc -g -O2   -I. -I../../src/gdb -I../../src/gdb/common -I../../src/gdb/config -DLOCALEDIR="\"/opt/gnu64/share/locale\"" -DHAVE_CONFIG_H -I../../src/gdb/../include/opcode -I../../src/gdb/../opcodes/.. -I../../src/gdb/../readline/.. -I../bfd -I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber -I../../src/gdb/../libdecnumber  -I../../src/gdb/gnulib/import -Ibuild-gnulib/import   -DTUI=1  -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Werror -c -o hppa-hpux-nat.o -MT hppa-hpux-nat.o -MMD -MP -MF .deps/hppa-hpux-nat.Tpo ../../src/gdb/hppa-hpux-nat.c
> ../../src/gdb/hppa-hpux-nat.c:45:1: error: no previous prototype for 'hppa_hpux_save_state_offset' [-Werror=missing-prototypes]
> cc1: all warnings being treated as errors
>
> Believe the function should be static.

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

	* hppa-hpux-nat.c (hppa_hpux_save_state_offset): Make static.
2013-03-13 18:50:16 +00:00
Pedro Alves 10217050c8 Fix completer.c FIXME, and invalid pointer to pointer conversion.
As mentioned in the previous patch, I grepped for "\*\*) &" and found
one hit in completer.c.

I was about to post a patch that simply made
current_demangling_style_string const, and cast away constness at the
xfree site.  However, looking deeper, it seem to be there's a lot of
dead code in the file.

First, all external callers of set_demangling_style are found in the
stabs reader, commented out for over 12 years:

  http://sourceware.org/ml/gdb-patches/2000-12/msg00214.html

I don't think it's likely we'll ever make the older mangling schemes
work for stabs.  If we do, we can rediscuss the approach then.

Then, set_demangling_command has special handling for unknown
demangling styles, but "set demangle-style" is an enum command, and
with those, the user can only specify a known enumeration value, by
design:

  (gdb) set demangle-style gangnam-style
  Undefined item: "gangnam-style".


This patch removes all that dead code, then makes
current_demangling_style_string point to an element of
demangling_style_names, as the FIXME suggests, and then makes
current_demangling_style_string, removing the need for the 'const char
**' cast.

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

	* dbxread.c (read_ofile_symtab, process_one_symbol): Remove
	commented out code.
	* demangle.c (current_demangling_style_string): Make it const.
	(set_demangling_command): Assert the demangling style is known.
	Remove all handling of unknown styles.  Set
	'current_demangling_style_string' to an element of the
	demangling_style_names array.
	(set_demangling_style): Delete.
	(_initialize_demangler): Set current_demangling_style_string to the
	element of the demangling_style_names array that corresponds to
	the default demangling style.  Remove FIXME note.  Don't call
	set_demangling_style.
	* gdb-demangle.h (set_demangling_style): Remove declaration.
2013-03-13 18:38:12 +00:00
Joel Brobecker 4fa7e2ff22 Extraneous NULL in linux_target_ops when HAVE_LINUX_BTRACE not defined
This fixes the followin error when HAVE_LINUX_BTRACE is not defined:

    linux-low.c:5943: error: excess elements in struct initializer
    linux-low.c:5943: error: (near initialization for 'linux_target_ops')

gdb/gdbserver/ChangeLog:

        * linux-low.c (linux_target_ops) [!HAVE_LINUX_BTRACE]:
        Remove extraneous NULL element.
2013-03-13 18:37:54 +00:00
Pedro Alves 6f937416b9 Constify strings in tracepoint.c, lookup_cmd and the completers.
This is sort of a continuation of Keith's parse_exp_1 constification
patch.  It started out by undoing these bits:

  @@ -754,9 +754,12 @@ validate_actionline (char **line, struct
   	  tmp_p = p;
   	  for (loc = t->base.loc; loc; loc = loc->next)
   	    {
  -	      p = tmp_p;
  -	      exp = parse_exp_1 (&p, loc->address,
  +	      const char *q;
  +
  +	      q = tmp_p;
  +	      exp = parse_exp_1 (&q, loc->address,
   				 block_for_pc (loc->address), 1);
  +	      p = (char *) q;

and progressively making more things const upwards, fixing fallout,
rinse repeat, until GDB built again (--enable-targets=all).

That ended up constifying lookup_cmd/add_cmd and (lots of) friends,
and the completers.

I didn't try to constify the command hooks themselves, because I know
upfront there are commands that write to the command string argument,
and I think I managed to stop at a nice non-hacky split point already.

I think the only non-really-super-obvious changes are
tracepoint.c:validate_actionline, and tracepoint.c:trace_dump_actions.

The rest is just mostly about 'char *' => 'const char *', 'char **'=>
'const char **', and the occasional (e.g., deprecated_cmd_warning)
case of 'char **'=> 'const char *', where/when I noticed that nothing
actually cares about the pointer to pointer output.

Tested on x86_64 Fedora 17, native and gdbserver.

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

	* ada-lang.c (struct add_partial_datum) <text, text0, word>: Make
	fields const.
	(ada_make_symbol_completion_list): Make "text0" parameter const.
	* ax-gdb.c (agent_eval_command_one): Make "exp" parameter const.
	* breakpoint.c (condition_completer): Make "text" and "word"
	parameters const.  Adjust.
	(check_tracepoint_command): Adjust to validate_actionline
	prototype change.
	(catch_syscall_completer): Make "text" and "word" parameters
	const.
	* cli/cli-cmds.c (show_user): Make "comname" local const.
	(valid_command_p): Make "command" parameter const.
	(alias_command): Make "alias_prefix" and "command_prefix" locals
	const.
	* cli/cli-decode.c (add_cmd): Make "name" parameter const.
	(add_alias_cmd): Make "name" and "oldname" parameters const.
	Adjust.  No longer make copy of OLDNAME.
	(add_prefix_cmd, add_abbrev_prefix_cmd, add_set_or_show_cmd)
	(add_setshow_cmd_full, add_setshow_enum_cmd)
	(add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd)
	(add_setshow_filename_cmd, add_setshow_string_cmd)
	(add_setshow_string_noescape_cmd)
	(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
	(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
	(add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd)
	(delete_cmd, add_info, add_info_alias, add_com, add_com_alias):
	Make "name" parameter const.
	(help_cmd): Rename "command" parameter to "arg".  New const local
	"command".
	(find_cmd): Make "command" parameter const.
	(lookup_cmd_1): Make "text" parameter pointer to const.  Adjust to
	deprecated_cmd_warning prototype change.
	(undef_cmd_error): Make "cmdtype" parameter const.
	(lookup_cmd): Make "line" parameter const.
	(deprecated_cmd_warning): Change type of "text" parameter to
	pointer to const char, from pointer to pointer to char.  Adjust.
	(lookup_cmd_composition): Make "text" parameter const.
	(complete_on_cmdlist, complete_on_enum): Make "text" and "word"
	parameters const.
	* cli/cli-decode.h (struct cmd_list_element) <name>: Make field
	const.
	* cli/cli-script.c (validate_comname): Make "tem" local const.
	(define_command): New const local "tem_c".  Use it in calls to
	lookup_cmd.
	(document_command): Make "tem" and "comfull" locals const.
	(show_user_1): Make "prefix" and "name" parameters const.
	* cli-script.h (show_user_1): Make "prefix" and "name" parameters
	const.
	* command.h (add_cmd, add_alias_cmd, add_prefix_cmd)
	(add_abbrev_prefix_cmd, completer_ftype, lookup_cmd, lookup_cmd_1)
	(deprecated_cmd_warning, lookup_cmd_composition, add_com)
	(add_com_alias, add_info, add_info_alias, complete_on_cmdlist)
	(complete_on_enum, add_setshow_enum_cmd)
	(add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd)
	(add_setshow_filename_cmd, add_setshow_string_cmd)
	(add_setshow_string_noescape_cmd)
	(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
	(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
	(add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd):
	Change prototypes, constifying strings.
	* completer.c (noop_completer, filename_completer): Make "text"
	and "prefix" parameters const.
	(location_completer, expression_completer)
	(complete_line_internal): Make "text" and "prefix" parameters
	const and adjust.
	(command_completer, signal_completer): Make "text" and "prefix"
	parameters const.
	* completer.h (noop_completer, filename_completer)
	(expression_completer, location_completer, command_completer)
	(signal_completer): Change prototypes.
	* corefile.c (complete_set_gnutarget): Make "text" and "word"
	parameters const.
	* cp-abi.c (cp_abi_completer): Likewise.
	* expression.h (parse_expression_for_completion): Change
	prototype.
	* f-lang.c (f_make_symbol_completion_list): Make "text" and "word"
	parameters const.
	* infcmd.c (_initialize_infcmd): Make "cmd_name" local const.
	* infrun.c (handle_completer): Make "text" and "word" parameters
	const.
	* interps.c (interpreter_completer): Make "text" and "word"
	parameters const.
	* language.h (struct language_defn)
	<la_make_symbol_completion_list>: Make "text" and "word"
	parameters const.
	* parse.c (parse_exp_1): Move const hack to parse_exp_in_context.
	(parse_exp_in_context): Rename to ...
	(parse_exp_in_context_1): ... this.
	(parse_exp_in_context): Reimplement, with const hack from
	parse_exp_1.
	(parse_expression_for_completion): Make "string" parameter const.
	* printcmd.c (decode_format): Make "string_ptr" parameter pointer
	to pointer to const char.  Adjust.
	(print_command_1): Make "exp" parameter const.
	(output_command): Rename to ...
	(output_command_const): ... this.  Make "exp" parameter const.
	(output_command): Reimplement.
	(x_command): Adjust.
	(display_command): Rename "exp" parameter to "arg".  New "exp"
	local, const version of "arg".
	* python/py-auto-load.c (gdbpy_initialize_auto_load): Make
	"cmd_name" local const.
	* python/py-cmd.c (cmdpy_destroyer): Cast const away in xfree
	call.
	(cmdpy_completer): Make "text" and "word" parameters const.
	(gdbpy_parse_command_name): Make "prefix_text2" local const.
	* python/py-param.c (add_setshow_generic): Make "tmp_name" local
	const.
	* remote.c (_initialize_remote): Make "cmd_name" local const.
	* symtab.c (language_search_unquoted_string): Make "text" and "p"
	parameters const.  Adjust.
	(completion_list_add_fields): Make "sym_text", "text" and "word"
	parameters const.
	(struct add_name_data) <sym_text, text, word>: Make fields const.
	(default_make_symbol_completion_list_break_on): Make "text" and
	"word" parameters const.  Adjust locals.
	(default_make_symbol_completion_list)
	(make_symbol_completion_list, make_symbol_completion_type)
	(make_symbol_completion_list_fn): Make "text" and "word"
	parameters const.
	(make_file_symbol_completion_list): Make "text", "word" and
	"srcfile" parameters const.  Adjust locals.
	(add_filename_to_list): Make "text" and "word" parameters const.
	(struct add_partial_filename_data) <text, word>: Make fields
	const.
	(make_source_files_completion_list): Make "text" and "word"
	parameters const.
	* symtab.h (default_make_symbol_completion_list_break_on)
	(default_make_symbol_completion_list, make_symbol_completion_list)
	(make_symbol_completion_type enum type_code)
	(make_symbol_completion_list_fn make_file_symbol_completion_list)
	(make_source_files_completion_list): Change prototype.
	* top.c (execute_command): Adjust to pass pointer to pointer to
	const char to lookup_cmd, and to deprecated_cmd_warning prototype
	change.
	(set_verbose): Make "cmdname" local const.
	* tracepoint.c (decode_agent_options): Make "exp" parameter const,
	and adjust.
	(validate_actionline): Make "line" parameter a pointer to const
	char, and adjust.
	(encode_actions_1): Make "action_exp" local const, and adjust.
	(encode_actions): Adjust.
	(replace_comma): Delete.
	(trace_dump_actions): Make "action_exp" and "next_comma" locals
	const, and adjust.  Don't frob the action string while splitting
	it at commas.  Instead, make a copy of each split substring in
	turn.
	(trace_dump_command): Adjust to validate_actionline prototype
	change.
	* tracepoint.h (decode_agent_options, decode_agent_options)
	(encode_actions, validate_actionline): Change prototypes.
	* valprint.h (output_command): Delete declaration.
	(output_command_const): Declare.
	* value.c (function_destroyer): Cast const away in xfree call.
2013-03-13 18:34:55 +00:00
Keith Seitz 6dd24dfaec * gdb.texinfo (Maintenance Commands): Add missing ')' for
"maint agent" reference to Dynamic printf.
2013-03-13 17:55:50 +00:00
Pedro Alves a0bcdaa75e More invalid pointer to pointer conversions.
As a follow up to:

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

In a nutshell, casts between 'char **' <-> 'unsigned char **' and
'char **' <-> 'const char **' are invalid.

I grepped for "\*\*) &" and found these.  There's another one in
demangle.c, but I've split fixing that one to a separate patch.

I think the ada_decode_symbol change is perhaps the one that could be
surprising.  The function's description has this comment, which makes
things much clearer:

   The GSYMBOL parameter is "mutable" in the C++ sense: logically
   const, but nevertheless modified to a semantically equivalent form
   when a decoded name is cached in it.  */

 const char *
 ada_decode_symbol (const struct general_symbol_info *gsymbol)

With that out of the way, I think the patch ends up being pretty
obvious.

Tested on x86_64 Fedora 17.

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

	* ada-lang.c (ada_decode_symbol): Cast away constness of GSYMBOL
	rather than casting 'const char * const *' to 'const char **'.
	* ada-lex.l (processInt): Make "trailer" local const.  Remove
	'const char **' cast.
	* arm-linux-tdep.c (arm_stap_parse_special_token): Add 'char *'
	locals, and use those as strtol output pointer, instead than doing
	invalid casts to from 'const char **' to 'char **'.
	(_initialize_demangle): Remove cast.
	* i386-tdep.c (i386_stap_parse_special_token): : Add 'char *'
	locals, and use those as strtol output pointer, instead than doing
	invalid casts to from 'const char **' to 'char **'.
	* solib-dsbt.c (dsbt_get_initial_loadmaps): Remove 'gdb_byte**'
	casts.
	* stap-probe.c (stap_parse_register_operand)
	(stap_parse_single_operand): Likewise.
2013-03-13 16:45:11 +00:00
Yao Qi 8ddb196517 * tracepoint.c (tfile_get_trace_state_variable_value): Look for
the last matched 'V' blcok in trace frame.

gdb/gdbserver:

	* tracepoint.c (traceframe_read_tsv): Look for the last matched
	'V' block in trace frame.

gdb/testsuite:

	* gdb.trace/tsv.exp (check_tsv): New.
	(top level): Save a tfile on current trace session. Call
	check_tsv on live target.  Load the tfile with target tfile
	and call check_tsv again.
2013-03-13 03:40:27 +00:00
Yao Qi 045dd51fd8 gdb/testsuite/
2013-03-13  Yao Qi  <yao@codesourcery.com>

	* gdb.trace/tsv.exp: Remove code unrelated to testing TSV.
	Replace some "gdb_test" with "gdb_test_no_output".
2013-03-13 03:25:13 +00:00
gdbadmin 411c1c2bb7 *** empty log message *** 2013-03-13 00:00:03 +00:00
Joel Brobecker 2d450646ca Update NEWS file following GDB 7.6 branch creation.
gdb/ChangeLog:

        * NEWS: Create a new section for the next release branch.
        Rename the section of the current branch, now that it has
        been cut.
2013-03-12 22:36:27 +00:00
gdbadmin b4b79973de Record GDB 7.6 branch creation. Bump version number to 7.6.50.20130312-cvs. 2013-03-12 22:23:41 +00:00
Keith Seitz ee0475543f * mi/mi-cmds.h (mi_execute_command): Make "cmd" const.
* mi/mi-interp.c (mi_interpreter_exec): Make "command" const.
	Remove temporary copy of input string.
	(mi_execute_command_wrapper): Make "cmd" const.
	* mi/mi-main.c (mi_execute_command): Make "string_ptr" const.
	* mi/mi-parse.c (mi_parse_argv): Make "args" const.
	Use const strings.
	(mi_parse): Make "cmd" const.
	Use const strings.
	* mi/mi-parse.h (mi_parse): Make "cmd" const.
2013-03-12 18:50:39 +00:00
Keith Seitz bbc13ae3db * ada-lang.c (ada_read_renaming_var_value): Pass const
pointer to expression string to parse_exp_1.
	(create_excep_cond_exprs): Likewise.
	* ax-gdb.c (agent_eval_command_one): Likewise.
	(maint_agent_printf_command): Likewise.
	Constify much of the string handling/parsing.
	* breakpoint.c (set_breakpoint_condition): Pass const
	pointer to expression string to parse_exp_1.
	(update_watchpoint): Likewise.
	(parse_cmd_to_aexpr): Constify string handling.
	Pass const pointer to parse_exp_1.
	(init_breakpoint_sal): Pass const pointer to parse_exp_1.
	(find_condition_and_thread): Likewise.
	Make TOK const.
	(watch_command_1): Make "arg" const.
	Constify string handling.
	Copy the expression string instead of changing the input
	string.
	(update_breakpoint_location): Pass const pointer to
	parse_exp_1.
	* eval.c (parse_and_eval_address): Make "exp" const.
	(parse_to_comma_and_eval): Make "expp" const.
	(parse_and_eval): Make "exp" const.
	* expression.h (parse_expression): Make argument const.
	(parse_exp_1): Make first argument const.
	* findcmd.c (parse_find_args): Treat "args" as const.
	* linespec.c (parse_linespec): Pass const pointer to
	linespec_expression_to_pc.
	(linespec_expression_to_pc): Make "exp_ptr" const.
	* parse.c (parse_exp_1): Make "stringptr" const.
	Make a copy of the expression to pass to parse_exp_in_context until
	this whole interface can be constified.
	(parse_expression): Make "string" const.
	* printcmd.c (ui_printf): Treat "arg" as const.
	Handle const strings.
	* tracepoint.c (validate_actionline): Pass const pointer to
	all calls to parse_exp_1.
	(encode_actions_1): Likewise.
	* value.h (parse_to_comma_and_eval): Make argument const.
	(parse_and_eval_address): Likewise.
	(parse_and_eval): Likewise.
	* varobj.c (varobj_create): Pass const pointer to parse_exp_1.
	(varobj_set_value): Likewise.
	* cli/cli-cmds.c (disassemble_command): Treat "arg" as const and
	constify string handling.
	Pass const pointers to parse_and_eval_address and
	parse_to_comman_and_eval.
	* cli/cli-utils.c (skip_to_space): Rename to ...
	(skip_to_space_const): ... this. Handle const strings.
	* cli/cli-utils.h (skip_to_space): Turn into macro which invokes
	skip_to_space_const.
	(skip_to_space_const): Declare.
	* common/format.c (parse_format_string): Make "arg" const.
	Handle const strings.
	* common/format.h (parse_format_string): Make "arg" const.
	* gdbserver/ax.c (ax_printf): Make "format" const.
	* python/python.c (gdbpy_parse_and_eval): Do not make a copy
	of the expression string.
2013-03-12 17:39:45 +00:00
Hui Zhu f3cec7e61f 2013-03-12 Hui Zhu <hui@codesourcery.com>
* dwarf2loc.c (dwarf2_compile_expr_to_ax): Update error message.
2013-03-12 15:44:06 +00:00
Hui Zhu 9df7235c1a 2013-03-12 Yao Qi <yao@codesourcery.com>
Hui Zhu  <hui@codesourcery.com>

	* dwarf2loc.c (access_memory): Change nbits to nbytes in gdb_assert.
	(dwarf2_compile_expr_to_ax): Call access_memory in DW_OP_deref and
	DW_OP_deref_size.
2013-03-12 14:44:56 +00:00
Paul N. Hilfinger 82d049abf1 Allow 'thread' to be used as a variable name in expressions.
GDB treats the identifiers 'if', 'thread', and 'task' unconditionally
as expression delimiters in Ada mode, which is correct for 'if' and 'task',
but wrong for 'thread' in cases such as

      print thread

Borrowing from c-exp.y, we observe that 'thread' must be followed by
numerals, whereas identifiers never are and treat them as delimiters
only in that case.

In the process, the current also refactors and incidentally fixes the
code for rewinding the input to before the delimiting tokens.  For
example, the code

      watch expr if i > 2

fails because the input is only rewound to just before the 'i',
leaving the 'if' as part of the expression (and thus making the
rest look like trailing junk rather than a conditional clause).

gdb/ChangeLog:

    * ada-lex.l (rules): Only recognize 'thread' as a
    delimiter when followed by numerals, as for c-exp.y.
    Use new rewind_to_char function to rewind the input for
    expression-delimiting tokens.
    (rewind_to_char): New function.

gdb/testsuite/ChangeLog:

    * gdb.ada/expr_delims.exp: New file.
    * gdb.ada/expr_delims/foo.adb: New file.
    * gdb.ada/expr_delims/pck.ads: New file.
    * gdb.ada/expr_delims/pck.adb: New file.
2013-03-12 09:03:11 +00:00
gdbadmin 79cbf65452 *** empty log message *** 2013-03-12 00:00:37 +00:00
Eli Zaretskii 5c4808caa6 * gdb.texinfo (General Query Packets): Don't use colon in index
entries visible to Info format.
2013-03-11 19:43:53 +00:00
Keith Seitz cb8ea32b8d * watchpoint.exp (test_no_hw_watchpoints): Add test using
both condition and thread.  Then delete the watchpoint.
2013-03-11 19:02:22 +00:00
Jan Kratochvil 8c1fb15545 gdb/
* configure: Regenerate.
	* configure.ac (check dynamic export flag): Link python test with
	$PYTHON_LIBS.
2013-03-11 18:49:37 +00:00
Doug Evans cc81e1c673 * linespec.c (find_linespec_symbols): Call find_function_symbols
first, and then call lookup_prefix_sym/find_method.
2013-03-11 18:24:59 +00:00
Pedro Alves 39086a0e13 Avoid invalid pointer to pointer conversions.
Casts between 'char **' <-> 'unsigned char **' and 'char **' <-> const
char **' are actually invalid:

  http://gcc.gnu.org/ml/gcc-help/2013-03/msg00118.html

In a nutshell, char (and variants) can alias anything, but pointers to
chars get no special treatment (cf. C99/N1256, 6.5/7).

Turns out older gcc's actually warn/complain on these constructs,
though newer one's don't:

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

This patch fixes the cases I added last week.  It also fixes one other
preexisting case in charset.c, though it seems even older gccs don't
complain of char * <-> const char * aliasing.

Tested on x86_64 Fedora 17.

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

	* charset.c (convert_between_encodings): Don't cast between
	different pointer to pointer types.  Instead, make the 'inp' local
	be of the type iconv expects.
	(wchar_iterate): Don't cast between different pointer to pointer
	types.  Instead, use new pointer local of the type iconv expects.
	* target.c (target_read_stralloc, target_fileio_read_stralloc):
	Add new local of type char pointer, and use it to get a
	char/string view of the byte buffer, instead of casting between
	pointer to pointer types.
2013-03-11 12:22:20 +00:00
Hafiz Abid Qadeer 905851752e 2013-03-11 Hafiz Abid Qadeer <abidh@codesourcery.com>
* remote.c (remote_set_trace_buffer_size): Move != operator
	to the start of next line to fix an ARI warning.
2013-03-11 12:20:52 +00:00
Markus Metzger 2f1d9bddcc Add tests for the new record-btrace target.
testsuite/
	* Makefile.in: Add btrace testsuite.
	* configure: Regenerated.
	* configure.ac: Add btrace testsuite.
	* gdb.btrace/Makefile.in: New file.
	* gdb.btrace/enable.c: New file.
	* gdb.btrace/enable.exp: New file.
	* gdb.btrace/function_call_history.c: New file.
	* gdb.btrace/function_call_history.exp: New file.
	* gdb.btrace/instruction_history.c: New file.
	* gdb.btrace/instruction_history.exp: New file.
	* gdb.btrace/instruction_history.S: New file.
	* lib/gdb.exp: Add btrace skip proc.
2013-03-11 08:59:00 +00:00
Markus Metzger 59ea568849 Document changes to the record target resulting from the renaming into
record-full.

Document two new record sub-commands "record instruction-history" and
"record function-call-history" and two associated set/show commands
"set record instruction-history-size" and "set record
function-call-history-size".

Add this to NEWS.

gdb/
	* NEWS: Add record changes.

doc/
	* gdb.texinfo (Process Record and Replay): Document record
	changes.
2013-03-11 08:55:36 +00:00
Markus Metzger 946287b73c Add a disassembly flag to omit the pc prefix and use it in the "record
instruction-history" command of record-btrace.

The pc prefix would appear multiple times in the branch trace disassembly,
which is more confusing than helpful.

gdb/
	* record-btrace.c (btrace_insn_history): Omit the pc prefix in
	the instruction history disassembly.
	* disasm.c (dump_insns): Omit the pc prefix, if requested.
	* disasm.h (DISASSEMBLY_OMIT_PC): New.
2013-03-11 08:53:17 +00:00
Markus Metzger afedecd388 Add a target for branch trace recording.
The target implements the new record sub-commands
"record instruction-history" and
"record function-call-history".

The target does not support reverse execution or navigation in the
recorded execution log.

gdb/
	* Makefile.in (SFILES): Add record-btrace.c
	(COMMON_OBS): Add record-btrace.o
	* record-btrace.c: New.
	* objfiles.c: Include btrace.h.
	(free_objfile): call btrace_free_objfile.
2013-03-11 08:51:58 +00:00
Markus Metzger 15984c13c7 Add command to print the function names from recorded instructions.
This command provides a quick high-level overview over the recorded execution
log at function granularity without having to reverse-step.

gdb/
	* target.c (target_call_history, target_call_history_from,
	target_call_history_range): New.
	* target.h (target_ops) <to_call_history, to_call_history_from,
	to_call_history_range>: New fields.
	(target_call_history, target_call_history_from,
	target_call_history_range): New declaration.
	* record.c (get_call_history_modifiers, cmd_record_call_history,
	record_call_history_size): New.
	(_initialize_record): Add the "record function-call-history" command.
	Add "set/show record function-call-history-size" commands.
	* record.h (record_print_flag): New.
2013-03-11 08:50:05 +00:00
Markus Metzger 67c86d0683 Add a command to provide a disassembly of the execution trace log.
gdb/
	* target.h (target_ops) <to_insn_history, to_insn_history_from,
	to_insn_history_range>: New fields.
	(target_insn_history): New.
	(target_insn_history_from): New.
	(target_insn_history_range): New.
	* target.c (target_insn_history): New.
	(target_insn_history_from): New.
	(target_insn_history_range): New.
	* record.c: Include cli/cli-utils.h, disasm.h, ctype.h.
	(record_insn_history_size): New.
	(get_insn_number): New.
	(get_context_size): New.
	(no_chunk): New.
	(get_insn_history_modifiers): New.
	(cmd_record_insn_history): New.
	(_initialize_record): Add "set/show record instruction-history-size"
	command. Add "record instruction-history" command.
2013-03-11 08:48:38 +00:00
Markus Metzger 7c1687a966 Provide default target methods for record targets that are likely to be shared
between different record targets.

gdb/
	* record.h (record_disconnect): New.
	(record_detach): New.
	(record_mourn_inferior): New.
	(record_kill): New.
	* record-full.c (record_disconnect, record_detach,
	record_mourn_inferior, record_kill): Move to...
	* record.c: ...here.
	(DEBUG): New.
	(record_stop): New.
	(record_unpush): New.
	(cmd_record_stop): Call record_stop. Replace unpush_target
	call with record_unpush call.
	(record_disconnect, record_detach): Assert that the target
	is of record stratum. Call record_unpush, record_stop, and
	DEBUG.
	(record_mourn_inferior, record_kill): Assert that the target
	is of record stratum. Call record_unpush and DEBUG.
2013-03-11 08:47:10 +00:00
Markus Metzger 25ea693b87 Rename record_ prefixes in record-full.h into record_full_.
gdb/
	* record-full.h, record-full.c (record_memory_query): Rename
	to ...
	(record_full_memory_query): ...this. Update all users.
	(record_arch_list_add_reg): Rename to ...
	(record_full_arch_list_add_reg): ...this. Update all users.
	(record_arch_list_add_mem): Rename to ...
	(record_full_arch_list_add_mem): ...this. Update all users.
	(record_arch_list_add_end): Rename to ...
	(record_full_arch_list_add_end): ...this. Update all users.
	(record_gdb_operation_disable_set): Rename to ...
	(record_full_gdb_operation_disable_set): ...this.
	Update all users.
2013-03-11 08:45:54 +00:00
Markus Metzger 88d1aa9d26 Rename record_ prefixes in record-full.c into record_full_.
gdb/
	* record-full.c (DEFAULT_RECORD_INSN_MAX_NUM): Renamed to ...
	(DEFAULT_RECORD_FULL_INSN_MAX_NUM): ... this. Updated all users.
	(RECORD_IS_REPLAY): Renamed to ...
	(RECORD_FULL_IS_REPLAY): ... this. Updated all users.
	(RECORD_FILE_MAGIC): Renamed to ...
	(RECORD_FULL_FILE_MAGIC): ... this. Updated all users.
	(record_mem_entry): Renamed to ...
	(record_full_mem_entry): ... this. Updated all users.
	(record_reg_entry): Renamed to ...
	(record_full_reg_entry): ... this. Updated all users.
	(record_end_entry): Renamed to ...
	(record_full_end_entry): ... this. Updated all users.
	(record_type) <record_end, record_reg, record_mem>: Renamed
	to ...
	(record_full_type) <record_full_end, record_full_reg,
	record_full_mem>: ... this. Updated all users.
	(record_entry): Renamed to ...
	(record_full_entry): ... this. Updated all users.
	(record_core_buf_entry): Renamed to ...
	(record_full_core_buf_entry): ... this. Updated all users.
	(record_core_regbuf): Renamed to ...
	(record_full_core_regbuf): ... this. Updated all users.
	(record_core_start): Renamed to ...
	(record_full_core_start): ... this. Updated all users.
	(record_core_end): Renamed to ...
	(record_full_core_end): ... this. Updated all users.
	(record_core_buf_list): Renamed to ...
	(record_full_core_buf_list): ... this. Updated all users.
	(record_first): Renamed to ...
	(record_full_first): ... this. Updated all users.
	(record_list): Renamed to ...
	(record_full_list): ... this. Updated all users.
	(record_arch_list_head): Renamed to ...
	(record_full_arch_list_head): ... this. Updated all users.
	(record_arch_list_tail): Renamed to ...
	(record_full_arch_list_tail): ... this. Updated all users.
	(record_stop_at_limit): Renamed to ...
	(record_full_stop_at_limit): ... this. Updated all users.
	(record_insn_max_num): Renamed to ...
	(record_full_insn_max_num): ... this. Updated all users.
	(record_insn_num): Renamed to ...
	(record_full_insn_num): ... this. Updated all users.
	(record_insn_count): Renamed to ...
	(record_full_insn_count): ... this. Updated all users.
	(record_ops): Renamed to ...
	(record_full_ops): ... this. Updated all users.
	(record_core_ops): Renamed to ...
	(record_full_core_ops): ... this. Updated all users.
	(set_record_cmdlist): Renamed to ...
	(set_record_full_cmdlist): ... this. Updated all users.
	(show_record_cmdlist): Renamed to ...
	(show_record_full_cmdlist): ... this. Updated all users.
	(record_cmdlist): Renamed to ...
	(record_full_cmdlist): ... this. Updated all users.
	(record_beneath_to_resume_ops): Renamed to ...
	(record_full_beneath_to_resume_ops): ... this. Updated all users.
	(record_beneath_to_resume): Renamed to ...
	(record_full_beneath_to_resume): ... this. Updated all users.
	(record_beneath_to_wait_ops): Renamed to ...
	(record_full_beneath_to_wait_ops): ... this. Updated all users.
	(record_beneath_to_wait): Renamed to ...
	(record_full_beneath_to_wait): ... this. Updated all users.
	(record_beneath_to_store_registers_ops): Renamed to ...
	(record_full_beneath_to_store_registers_ops): ... this.
	Updated all users.
	(record_beneath_to_store_registers): Renamed to ...
	(record_full_beneath_to_store_registers): ... this.
	Updated all users.
	(record_beneath_to_xfer_partial_ops): Renamed to ...
	(record_full_beneath_to_xfer_partial_ops): ... this.
	Updated all users.
	(record_beneath_to_xfer_partial): Renamed to ...
	(record_full_beneath_to_xfer_partial): ... this.
	Updated all users.
	(record_beneath_to_insert_breakpoint): Renamed to ...
	(record_full_beneath_to_insert_breakpoint): ... this.
	Updated all users.
	(record_beneath_to_stopped_by_watchpoint): Renamed to ...
	(record_full_beneath_to_stopped_by_watchpoint): ... this.
	Updated all users.
	(record_beneath_to_stopped_data_address): Renamed to ...
	(record_full_beneath_to_stopped_data_address): ... this.
	Updated all users.
	(record_beneath_to_async): Renamed to ...
	(record_full_beneath_to_async): ... this. Updated all users.
	(record_goto_insn): Renamed to ...
	(record_full_goto_insn): ... this. Updated all users.
	(record_save): Renamed to ...
	(record_full_save): ... this. Updated all users.
	(record_reg_alloc): Renamed to ...
	(record_full_reg_alloc): ... this. Updated all users.
	(record_reg_release): Renamed to ...
	(record_full_reg_release): ... this. Updated all users.
	(record_mem_alloc): Renamed to ...
	(record_full_mem_alloc): ... this. Updated all users.
	(record_mem_release): Renamed to ...
	(record_full_mem_release): ... this. Updated all users.
	(record_end_alloc): Renamed to ...
	(record_full_end_alloc): ... this. Updated all users.
	(record_end_release): Renamed to ...
	(record_full_end_release): ... this. Updated all users.
	(record_entry_release): Renamed to ...
	(record_full_entry_release): ... this. Updated all users.
	(record_list_release): Renamed to ...
	(record_full_list_release): ... this. Updated all users.
	(record_list_release_following): Renamed to ...
	(record_full_list_release_following): ... this.
	Updated all users.
	(record_list_release_first): Renamed to ...
	(record_full_list_release_first): ... this. Updated all users.
	(record_arch_list_add): Renamed to ...
	(record_full_arch_list_add): ... this. Updated all users.
	(record_get_loc): Renamed to ...
	(record_full_get_loc): ... this. Updated all users.
	(record_check_insn_num): Renamed to ...
	(record_full_check_insn_num): ... this. Updated all users.
	(record_arch_list_cleanups): Renamed to ...
	(record_full_arch_list_cleanups): ... this. Updated all users.
	(record_message): Renamed to ...
	(record_full_message): ... this. Updated all users.
	(record_message_wrapper): Renamed to ...
	(record_full_message_wrapper): ... this. Updated all users.
	(record_message_wrapper_safe): Renamed to ...
	(record_full_message_wrapper_safe): ... this. Updated all users.
	(record_gdb_operation_disable): Renamed to ...
	(record_full_gdb_operation_disable): ... this. Updated all users.
	(record_hw_watchpoint): Renamed to ...
	(record_full_hw_watchpoint): ... this. Updated all users.
	(record_exec_insn): Renamed to ...
	(record_full_exec_insn): ... this. Updated all users.
	(record_restore): Renamed to ...
	(record_full_restore): ... this. Updated all users.
	(record_async_inferior_event_token): Renamed to ...
	(record_full_async_inferior_event_token): ... this.
	Updated all users.
	(record_async_inferior_event_handler): Renamed to ...
	(record_full_async_inferior_event_handler): ... this.
	Updated all users.
	(record_core_open_1): Renamed to ...
	(record_full_core_open_1): ... this. Updated all users.
	(record_open_1): Renamed to ...
	(record_full_open_1): ... this. Updated all users.
	(record_open): Renamed to ...
	(record_full_open): ... this. Updated all users.
	(record_close): Renamed to ...
	(record_full_close): ... this. Updated all users.
	(record_resume_step): Renamed to ...
	(record_full_resume_step): ... this. Updated all users.
	(record_resumed): Renamed to ...
	(record_full_resumed): ... this. Updated all users.
	(record_execution_dir): Renamed to ...
	(record_full_execution_dir): ... this. Updated all users.
	(record_resume): Renamed to ...
	(record_full_resume): ... this. Updated all users.
	(record_get_sig): Renamed to ...
	(record_full_get_sig): ... this. Updated all users.
	(record_sig_handler): Renamed to ...
	(record_full_sig_handler): ... this. Updated all users.
	(record_wait_cleanups): Renamed to ...
	(record_full_wait_cleanups): ... this. Updated all users.
	(record_wait_1): Renamed to ...
	(record_full_wait_1): ... this. Updated all users.
	(record_wait): Renamed to ...
	(record_full_wait): ... this. Updated all users.
	(record_stopped_by_watchpoint): Renamed to ...
	(record_full_stopped_by_watchpoint): ... this. Updated all users.
	(record_disconnect): Renamed to ...
	(record_full_disconnect): ... this. Updated all users.
	(record_detach): Renamed to ...
	(record_full_detach): ... this. Updated all users.
	(record_mourn_inferior): Renamed to ...
	(record_full_mourn_inferior): ... this. Updated all users.
	(record_kill): Renamed to ...
	(record_full_kill): ... this. Updated all users.
	(record_stopped_data_address): Renamed to ...
	(record_full_stopped_data_address): ... this. Updated all users.
	(record_registers_change): Renamed to ...
	(record_full_registers_change): ... this. Updated all users.
	(record_store_registers): Renamed to ...
	(record_full_store_registers): ... this. Updated all users.
	(record_xfer_partial): Renamed to ...
	(record_full_xfer_partial): ... this. Updated all users.
	(record_breakpoint): Renamed to ...
	(record_full_breakpoint): ... this. Updated all users.
	(record_breakpoint_p): Renamed to ...
	(record_full_breakpoint_p): ... this. Updated all users.
	(record_breakpoints): Renamed to ...
	(record_full_breakpoints): ... this. Updated all users.
	(record_sync_record_breakpoints): Renamed to ...
	(record_full_sync_record_breakpoints): ... this.
	Updated all users.
	(record_init_record_breakpoints): Renamed to ...
	(record_full_init_record_breakpoints): ... this.
	Updated all users.
	(record_insert_breakpoint): Renamed to ...
	(record_full_insert_breakpoint): ... this. Updated all users.
	(record_remove_breakpoint): Renamed to ...
	(record_full_remove_breakpoint): ... this. Updated all users.
	(record_can_execute_reverse): Renamed to ...
	(record_full_can_execute_reverse): ... this. Updated all users.
	(record_get_bookmark): Renamed to ...
	(record_full_get_bookmark): ... this. Updated all users.
	(record_goto_bookmark): Renamed to ...
	(record_full_goto_bookmark): ... this. Updated all users.
	(record_async): Renamed to ...
	(record_full_async): ... this. Updated all users.
	(record_can_async_p): Renamed to ...
	(record_full_can_async_p): ... this. Updated all users.
	(record_is_async_p): Renamed to ...
	(record_full_is_async_p): ... this. Updated all users.
	(record_execution_direction): Renamed to ...
	(record_full_execution_direction): ... this. Updated all users.
	(record_info): Renamed to ...
	(record_full_info): ... this. Updated all users.
	(record_delete): Renamed to ...
	(record_full_delete): ... this. Updated all users.
	(record_is_replaying): Renamed to ...
	(record_full_is_replaying): ... this. Updated all users.
	(record_goto_entry): Renamed to ...
	(record_full_goto_entry): ... this. Updated all users.
	(record_goto_begin): Renamed to ...
	(record_full_goto_begin): ... this. Updated all users.
	(record_goto_end): Renamed to ...
	(record_full_goto_end): ... this. Updated all users.
	(record_goto): Renamed to ...
	(record_full_goto): ... this. Updated all users.
	(init_record_ops): Renamed to ...
	(init_record_full_ops): ... this. Updated all users.
	(record_core_resume): Renamed to ...
	(record_full_core_resume): ... this. Updated all users.
	(record_core_kill): Renamed to ...
	(record_full_core_kill): ... this. Updated all users.
	(record_core_fetch_registers): Renamed to ...
	(record_full_core_fetch_registers): ... this. Updated all users.
	(record_core_prepare_to_store): Renamed to ...
	(record_full_core_prepare_to_store): ... this. Updated all users.
	(record_core_store_registers): Renamed to ...
	(record_full_core_store_registers): ... this. Updated all users.
	(record_core_xfer_partial): Renamed to ...
	(record_full_core_xfer_partial): ... this. Updated all users.
	(record_core_insert_breakpoint): Renamed to ...
	(record_full_core_insert_breakpoint): ... this. Updated all users.
	(record_core_remove_breakpoint): Renamed to ...
	(record_full_core_remove_breakpoint): ... this. Updated all users.
	(record_core_has_execution): Renamed to ...
	(record_full_core_has_execution): ... this. Updated all users.
	(init_record_core_ops): Renamed to ...
	(init_record_full_core_ops): ... this. Updated all users.
	(cmd_record_restore): Renamed to ...
	(cmd_record_full_restore): ... this. Updated all users.
	(record_save_cleanups): Renamed to ...
	(record_full_save_cleanups): ... this. Updated all users.
	(cmd_record_start): Renamed to ...
	(cmd_record_full_start): ... this. Updated all users.
	(set_record_insn_max_num): Renamed to ...
	(set_record_full_insn_max_num): ... this. Updated all users.
	(set_record_command): Renamed to ...
	(set_record_full_command): ... this. Updated all users.
	(show_record_command): Renamed to ...
	(show_record_full_command): ... this. Updated all users.
	(_initialize_record): Renamed to ...
	(_initialize_record_full): ... this. Updated all users.
2013-03-11 08:44:14 +00:00
Markus Metzger d02ed0bbfa Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.

The split leaves the command part in record.c and moves the target part into
record-full.c.

gdb/
	* record.h: Split into this and ...
	* record-full.h: ... this.
	* record.c: Split into this and ...
	* record-full.c: ... this.
	* target.h (target_ops): Add new fields to_info_record,
	to_save_record, to_delete_record, to_record_is_replaying,
	to_goto_record_begin, to_goto_record_end, to_goto_record.
	(target_info_record): New.
	(target_save_record): New.
	(target_supports_delete_record): New.
	(target_delete_record): New.
	(target_record_is_replaying): New.
	(target_goto_record_begin): New.
	(target_goto_record_end): New.
	(target_goto_record): New.
	* target.c (target_info_record): New.
	(target_save_record): New.
	(target_supports_delete_record): New.
	(target_delete_record): New.
	(target_record_is_replaying): New.
	(target_goto_record_begin): New.
	(target_goto_record_end): New.
	(target_goto_record): New.
	* record.h: Declare struct cmd_list_element.
	(record_cmdlist): New declaration.
	(set_record_cmdlist): New declaration.
	(show_record_cmdlist): New declaration.
	(info_record_cmdlist): New declaration.
	(cmd_record_goto): New declaration.
	* record.c: Remove unnecessary includes.
	Include inferior.h.
	(cmd_record_goto): Remove declaration.
	(record_cmdlist): Now extern. Initialize.
	(set_record_cmdlist): Now extern. Initialize.
	(show_record_cmdlist): Now extern. Initialize.
	(info_record_cmdlist): Now extern. Initialize.
	(find_record_target): New.
	(require_record_target): New.
	(cmd_record_start): Update.
	(cmd_record_delete): Remove target-specific code.
	Call target_delete_record.
	(cmd_record_stop): Unpush any record target.
	(set_record_insn_max_num): Move to record-full.c
	(set_record_command): Add comment.
	(show_record_command): Add comment.
	(info_record_command): Update comment.
	Remove target-specific code.
	Call the record target's to_info_record.
	(cmd_record_start): New.
	(cmd_record_goto): Now extern.
	Remove target-specific code.
	Call target_goto_begin,  target_goto_end, or target_goto.
	(_initialize_record): Move record target ops initialization to
	record-full.c.
	Change "record" command help text.
	Move "record restore", "record set", and "record show" commands to
	record-full.c.
	* Makefile.in (SFILES): Add record-full.c.
	(HFILES_NO_SRCDIR): Add record-full.h.
	(COMMON_OBS): Add record-full.o.
	* amd64-linux-tdep.c: Include record-full.h instead of record.h.
	* arm-tdep.c: Include record-full.h.
	* i386-linux-tdep.c: Include record-full.h instead of record.h.
	* i386-tdep.c: Include record-full.h.
	* infrun.c: Include record-full.h.
	* linux-record.c: Include record-full.h.
	* moxie-tdep.c: Include record-full.h.
	* record-full.c: Include record-full.h.
	Change module comment.
	(set_record_full_cmdlist): New.
	(show_record_full_cmdlist): New.
	(record_full_cmdlist): New.
	(record_goto_insn): New declaration.
	(record_save): New declaration.
	(record_check_insn_num): Change query string.
	(record_info): New.
	(record_delete): New.
	(record_is_replaying): New.
	(record_goto_entry): New.
	(record_goto_begin): New.
	(record_goto_end): New.
	(record_goto): New.
	(init_record_ops): Update.
	(init_record_core_ops): Update.
	(cmd_record_save): Rename to record_save. Remove target and arg checks.
	(cmd_record_start): New.
	(set_record_insn_max_num): Moved from record.c
	(set_record_full_command): New.
	(show_record_full_command): New.
	(_initialize_record_full): New.
2013-03-11 08:42:55 +00:00
Markus Metzger b48d48ebed Add a new function to target.h to add an alias command for a target and mark it
deprecated.  This is useful when renaming targets.

gdb/
	* target.h (add_deprecated_target_alias): New.
	* target.c (add_deprecated_target_alias): New.
2013-03-11 08:39:38 +00:00
Markus Metzger a950d57c9f LBR, BTM, or BTS records may have incorrect branch "from" information afer an
EIST transition, T-states, C1E, or Adaptive Thermal Throttling (AAJ122).

This results in sporadic test fails. Disable btrace on those processors.

gdb/
	* common/linux-btrace.c: Include sys/ptrace, sys/types, sys/wait.h,
	and signal.h.
	(linux_supports_btrace): Add kernel and
	cpuid check.
	(kernel_supports_btrace): New function.
	(cpu_supports_btrace): New function.
	(intel_supports_btrace): New function.
2013-03-11 08:38:27 +00:00
Markus Metzger 2ae8c8e7ce Document the branch tracing extensions to the remote serial protocol.
doc/
	* gdb.texinfo (Requirements): List qXfer:btrace:read requiring expat.
	(General Query Packets): Describe Qbtrace:bts, Qbtrace:off, and
	qXfer:btrace:read.
2013-03-11 08:36:57 +00:00
Markus Metzger 9accd112a6 Add the gdb remote target operations for branch tracing.
We define the following packets:

  Qbtrace:bts         enable branch tracing for the current thread
                      returns "OK" or "Enn"

  Qbtrace:off         disable branch tracing for the current thread
                      returns "OK" or "Enn"

  qXfer:btrace:read   read the full branch trace data for the current thread

gdb/
	* target.h (enum target_object): Add TARGET_OBJECT_BTRACE.
	* remote.c: Include btrace.h.
	(struct btrace_target_info): New struct.
	(remote_supports_btrace): New function.
	(send_Qbtrace): New function.
	(remote_enable_btrace): New function.
	(remote_disable_btrace): New function.
	(remote_teardown_btrace): New function.
	(remote_read_btrace): New function.
	(init_remote_ops): Add btrace ops.
	(enum <unnamed>): Add btrace packets.
	(struct protocol_feature remote_protocol_features[]): Add btrace packets.
	(_initialize_remote): Add packet configuration for branch tracing.

gdbserver/
	* target.h (struct target_ops): Add btrace ops.
	(target_supports_btrace): New macro.
	(target_enable_btrace): New macro.
	(target_disable_btrace): New macro.
	(target_read_btrace): New macro.
	* gdbthread.h (struct thread_info): Add btrace field.
	* server.c: Include btrace-common.h.
	(handle_btrace_general_set): New function.
	(handle_btrace_enable): New function.
	(handle_btrace_disable): New function.
	(handle_general_set): Call handle_btrace_general_set.
	(handle_qxfer_btrace): New function.
	(struct qxfer qxfer_packets[]): Add btrace entry.
	* inferiors.c (remove_thread): Disable btrace.
	* linux-low: Include linux-btrace.h.
	(linux_low_enable_btrace): New function.
	(linux_low_read_btrace): New function.
	(linux_target_ops): Add btrace ops.
	* configure.srv (i[34567]86-*-linux*): Add linux-btrace.o.
	Add srv_linux_btrace=yes.
	(x86_64-*-linux*): Add linux-btrace.o.
	Add srv_linux_btrace=yes.
	* configure.ac: Define HAVE_LINUX_BTRACE.
	* config.in: Regenerated.
	* configure: Regenerated.
2013-03-11 08:35:11 +00:00
Markus Metzger 5cc22e4cf7 Preserve a verbose error message of xfer functions if they return -3.
gdbserver/
	* server.c (handle_qxfer): Preserve error message if -3 is
	returned.
	(qxfer): Document the -3 return value.
2013-03-11 08:31:48 +00:00
Markus Metzger c12a29171f Define the xml document style for transferring branch trace data.
Add a function to parse a btrace xml document into a vector of branch trace
blocks.

gdb/
	* features/btrace.dtd: New file.
	* Makefile.in (XMLFILES): Add btrace.dtd.
	* btrace.h (parse_xml_btrace): New declaration.
	* btrace.c: Include xml-support.h.
	(parse_xml_btrace): New function.
	(parse_xml_btrace_block): New function.
	(block_attributes): New struct.
	(btrace_attributes): New struct.
	(btrace_children): New struct.
	(btrace_elements): New struct.
2013-03-11 08:28:58 +00:00
Markus Metzger 3e3aea48e2 Install the btrace target ops for i386-linux-nat and amd64-linux-nat.
gdb/
	* amd64-linux-nat.c: Include btrace.h and linux-btrace.h.
	(amd64_linux_enable_btrace): New.
	(amd64_linux_disable_btrace): New.
	(amd64_linux_teardown_btrace): New.
	(_initialize_amd64_linux_nat): Initialize btrace ops.
	* i386-linux.nat.c: Include btrace.h and linux-btrace.h.
	(i386_linux_enable_btrace): New.
	(i386_linux_disable_btrace): New.
	(i386_linux_teardown_btrace): New.
	(_initialize_i386_linux_nat): Initialize btrace ops.
	* config/i386/linux.mh: Add linux-btrace.o.
	* config/i386/linux64.mh: Add linux-btrace.o.
2013-03-11 08:25:58 +00:00
Markus Metzger 7c97f91ebf Implement branch tracing on Linux based on perf_event such that it can be shared
between gdb and gdbserver.

gdb/
	* common/linux_btrace.h: New file.
	* common/linux_btrace.c: New file.
	* Makefile.in (SFILES): Add btrace.c.
	(HFILES_NO_SRCDIR): Add common/linux-btrace.h.
	(COMMON_OBS): Add btrace.o.
	(linux-btrace.o): New rule.

gdbserver/
	* Makefile.in (SFILES): Add $(srcdir)/common/linux-btrace.c.
	(linux_btrace_h): New variable.
	(linux-btrace.o): New rule.
2013-03-11 08:24:07 +00:00
Markus Metzger 1999790bb6 Fix ChangeLog date. 2013-03-11 08:19:33 +00:00
Markus Metzger 02d2762576 Add branch trace information to struct thread_info.
Add functions to enable, disable, clear, and fetch a thread's branch trace.

gdb/
	* target.h: Include btrace.h.
	(struct target_ops) <to_supports_btrace, to_enable_btrace,
	to_disable_btrace, to_teardown_btrace, to_read_btrace>: New.
	* target.c (target_supports_btrace): New function.
	(target_enable_btrace): New function.
	(target_disable_btrace): New function.
	(target_teardown_btrace): New function.
	(target_read_btrace): New function.
	* btrace.h: New file.
	* btrace.c: New file.
	* Makefile.in: Add btrace.c.
	* gdbthread.h: Include btrace.h.
	(struct thread_info): Add btrace field.
	* thread.c: Include btrace.h.
	(clear_thread_inferior_resources): Call target_teardown_btrace.
	* common/btrace-common.h: New file.
2013-03-11 08:17:08 +00:00
gdbadmin 7bc0ae020f *** empty log message *** 2013-03-11 00:00:03 +00:00
Jan Kratochvil 61a31a6769 gdb/
* common/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Call also kill
	for CHILD, ignore PTRACE_KILL errors, move the inner block variable
	kill_status to outer block.
2013-03-10 18:07:57 +00:00
Jan Kratochvil 05c56a9d39 gdb/
Fix entry-values if the callee called a noreturn function.
	* dwarf2-frame-tailcall.c (dwarf2_tailcall_sniffer_first): Use
	get_frame_address_in_block.  Add new comment.

gdb/testsuite/
	Fix entry-values if the callee called a noreturn function.
	* gdb.arch/amd64-tailcall-noret.S: New file.
	* gdb.arch/amd64-tailcall-noret.c: New file.
	* gdb.arch/amd64-tailcall-noret.exp: New file.
2013-03-10 18:06:26 +00:00
Jan Kratochvil 9112db0926 gdb/
Fix entry-values in C++ across CUs.
	* dwarf2loc.c (call_site_to_target_addr) <FIELD_LOC_KIND_PHYSNAME>: Use
	lookup_minimal_symbol.  Add a comment.
	* dwarf2read.c
	(read_call_site_scope) <is_ref_attr> <die_is_declaration>: Prefer
	DW_AT_linkage_name.

gdb/testsuite/
	Fix entry-values in C++ across CUs.
	* gdb.arch/amd64-tailcall-cxx.exp: New file.
	* gdb.arch/amd64-tailcall-cxx1.S: New file.
	* gdb.arch/amd64-tailcall-cxx1.cc: New file.
	* gdb.arch/amd64-tailcall-cxx2.S: New file.
	* gdb.arch/amd64-tailcall-cxx2.cc: New file.
2013-03-10 18:04:00 +00:00
gdbadmin 55e9373143 *** empty log message *** 2013-03-10 00:00:03 +00:00
Hafiz Abid Qadeer be9a119c31 2013-03-09 Hafiz Abid Qadeer <abidh@codesourcery.com>
Fixed year number in Changelog files.
2013-03-09 12:05:20 +00:00
Eli Zaretskii 28abe18874 Fix last commit.
doc/gdb.texinfo (General Query Packets, Tracepoint Packets): Don't
 use colons in @anchor and @cindex entries.
2013-03-09 11:01:01 +00:00
Hafiz Abid Qadeer 6790eb9f17 2012-03-09 Hafiz Abid Qadeer <abidh@codesourcery.com>
* gdb.texinfo (QTBuffer:size): Add cindex and anchor.
2013-03-09 10:21:42 +00:00
gdbadmin 54b1f71883 *** empty log message *** 2013-03-09 00:00:02 +00:00
Yao Qi 9b67fcec82 gdb/
* tracepoint.c (_initialize_tracepoint): Indent the code.
2013-03-08 15:35:06 +00:00
Pedro Alves 6221be90ef find command, fix -Wpoint-sign
From: Pedro Alves <palves@redhat.com>

The find command's patter/buffer that is passed to the target is a
binary blob, not a string.

$ make WERROR_CFLAGS="-Wpointer-sign -Werror" findcmd.o -k 2>&1 1>/dev/null
../../src/gdb/findcmd.c: In function ‘find_command’:
../../src/gdb/findcmd.c:278:6: error: pointer targets in passing argument 3 of ‘target_search_memory’ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/findcmd.c:26:0:
../../src/gdb/target.h:1582:12: note: expected ‘const gdb_byte *’ but argument is of type ‘char *’

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

	* findcmd.c (put_bits): Change type of parameter to 'gdb_byte *'.
	(parse_find_args, find_command): Change type of pattern buffer
	locals to 'gdb_byte *'.
2013-03-08 15:22:44 +00:00
Hafiz Abid Qadeer f6f899bfc5 2012-03-08 Stan Shebs <stan@codesourcery.com>
Hafiz Abid Qadeer  <abidh@codesourcery.com>

	gdb/
	* NEWS: Mention set and show trace-buffer-size commands.
	Mention new packet.
	* target.h (struct target_ops): New method
	to_set_trace_buffer_size.
	(target_set_trace_buffer_size): New macro.
	* target.c (update_current_target): Set up new method.
	* tracepoint.c (trace_buffer_size): New global.
	(start_tracing): Send it to the target.
	(set_trace_buffer_size): New function.
	(_initialize_tracepoint): Add new setshow for trace-buffer-size.
	* remote.c (remote_set_trace_buffer_size): New function.
	(_initialize_remote): Use it.
	(QTBuffer:size) New remote command.
	(PACKET_QTBuffer_size): New enum.
	(remote_protocol_features): Add an entry for
	PACKET_QTBuffer_size.

	gdb/gdbserver/
	* tracepoint.c (trace_buffer_size): New global.
	(DEFAULT_TRACE_BUFFER_SIZE): New define.
	(init_trace_buffer): Change to one-argument function. Allocate
	trace buffer memory.
	(handle_tracepoint_general_set): Call cmd_bigqtbuffer_size to
	handle QTBuffer:size packet.
	(cmd_bigqtbuffer_size): New function.
	(initialize_tracepoint): Call init_trace_buffer with
	DEFAULT_TRACE_BUFFER_SIZE.
	* server.c (handle_query): Add QTBuffer:size in the
	supported packets.

	gdb/doc/
	* gdb.texinfo (Starting and Stopping Trace Experiments): Document
	trace-buffer-size set and show commands.
	(Tracepoint Packets): Document QTBuffer:size.
	(General Query Packets): Document QTBuffer:size.

	gdb/testsuite/
	* gdb.trace/trace-buffer-size.exp: New file.
	* gdb.trace/trace-buffer-size.c: New file.
2013-03-08 15:06:39 +00:00
Tom Tromey 7da3ab7920 * remote-m32r-sdi.c (m32r_load): Call skip_spaces on correct
variable.
2013-03-08 14:42:23 +00:00
gdbadmin 12afa43e27 *** empty log message *** 2013-03-08 00:00:34 +00:00
Pedro Alves 0c1f71e728 target.c: fix -Wpointer-sign
$ make WERROR_CFLAGS="-Wpointer-sign -Werror" target.o -k 2>&1 1>/dev/null
../../src/gdb/target.c: In function ‘target_read_stralloc’:
../../src/gdb/target.c:2376:3: error: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Werror=pointer-sign]
In file included from build-gnulib/import/string.h:27:0,
                 from ../../src/gdb/common/gdb_string.h:24,
                 from ../../src/gdb/target.c:24:
/usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘gdb_byte *’
...

This is about the same as the previous patch.

Functions that take or return ascii-ish string arguments usually use
char* for parameters/return.  That means that at points we call into
target methods that work with binary blobs, we need casts to/from
gdb_byte*/char*.  To choose which type for the variables, I usually go
based on which requires the fewer casts, and what the contents of the
variable are supposed to hold, which often gives the same answer.

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

	* target.c (target_read_stralloc, target_fileio_read_alloc):
	*Cast pointer to 'gdb_byte *' in target call.
2013-03-07 23:53:12 +00:00
Pedro Alves c8af03a2f5 corefile.c: fix -Wpointer-sign
$ make WERROR_CFLAGS="-Wpointer-sign -Werror" corefile.o -k 2>&1 1>/dev/null
../../src/gdb/corefile.c: In function ‘read_memory_string’:
../../src/gdb/corefile.c:334:7: error: pointer targets in passing argument 2 of ‘read_memory’ differ in signedness [-Werror=pointer-sign]
../../src/gdb/corefile.c:217:1: note: expected ‘gdb_byte *’ but argument is of type ‘char *’

Functions that take or return ascii-ish string arguments usually use
char* for parameters/return.  That means that at points we call into
target methods that work with binary blobs, we need casts to
gdb_byte*.

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

	* corefile.c (read_memory_string): Cast pointer to gdb_byte* in
	call.
2013-03-07 23:36:01 +00:00
Keith Seitz 529480d058 * breakpoint.c (catch_syscall_split_args): Use skip_spaces.
(trace_pass_command): Likewise.
	* cli/cli-cmds.c: Include cli/cli-utils.h.
	(source_command): Use skip-spaces.
	(disassemble_command): Likewise.
	* findcmd.c: Include cli/cli-utils.h.
	(parse_find_args): Use skip_spaces.
	* go32-nat.c: Include cli/cli-utils.h.
	(go32_sldt): Use skip_spaces.
	(go32_sgdt): Likewise.
	(go32_sidt): Likewise.
	(go32_pde): Likewise.
	(go32_pte): Likewise.
	(go32_pte_for_address): Likewise.
	* infcmd.c: Include cli/cli-utils.h.
	(registers_info): Use skip_spaces.
	* linux-tdep.c (read_mapping): Use skip_spaces_const.
	(linux_info_proc): Likewise.
	* linux-thread-db.c: Include cli/cli-utils.h.
	(info_auto_load_libthread_db): Use skip_spaces_const.
	* m32r-rom.c: Include cli/cli-utils.h.
	(m32r_upload_command): Use skip_spaces.
	* maint.c: Include cli/cli-utils.h.
	(maintenance_translate_address): Use skip_spaces.
	* mi/mi-parse.c: Include cli/cli-utils.h.
	(mi_parse_argv): Use skip_spaces.
	(mi_parse): Likewise.
	* minsyms.c: Include cli/cli-utils.h.
	(msymbol_hash_iw): Use skip_spaces_const.
	* objc-lang.c: Include cli/cli-utils.h.
	(parse_selector): Use skip_spaces.
	(parse_method): Likewise.
	* python/python.c: Include cli/cli-utils.h.
	(python_interactive_command)[HAVE_PYTHON]: Use skip_spaces.
	(python_command)[HAVE_PYTHON]: Likewise.
	(python_interactive_command)[!HAVE_PYTHON]: Likewise.
	* remote-m32r-sdi.c: Include cli/cli-utils.h.
	(m32r_load): Use skip_spaces.
	* serial.c: Include cli/cli-utils.h.
	(serial_open): Use skip_spaces_const.
	* stack.c: Include cli/cli-utils.h.
	(parse_frame_specification_1): Use skip_spaces_const.
	* symfile.c: Include cli/cli-utils.h.
	(set_ext_lang_command): Use skip_spaces.
	* symtab.c: Include cli/cli-utils.h.
	(rbreak_command): Use skip_spaces.
	* thread.c (thread_name_command): Use skip_spaces.
	* tracepoint.c (validate_actionline): Use skip_spaces.
	(encode_actions_1): Likewise.
	(trace_find_range_command): Likewise.
	(trace_find_outside_command): Likewise.
	(trace_dump_actions): Likewise.
2013-03-07 21:57:30 +00:00
Pedro Alves ac91cd701e Fix -Wpointer-sign around strings/encoding conversions.
Trimmed for brevity:

$ make WERROR_CFLAGS="-Wpointer-sign -Werror" c-lang.o expprint.o utils.o valprint.o varobj.o -k 2>&1 1>/dev/null
../../src/gdb/c-lang.c: In function ‘parse_one_string’:
../../src/gdb/c-lang.c:540:8: error: pointer targets in passing argument 3 of ‘convert_between_encodings’ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/c-lang.c:30:0:
../../src/gdb/charset.h:64:6: note: expected ‘const gdb_byte *’ but argument is of type ‘char *’

../../src/gdb/expprint.c: In function ‘print_subexp_standard’:
../../src/gdb/expprint.c:205:2: error: pointer targets in passing argument 3 of ‘current_language->la_printstr’ differ in signedness [-Werror=pointer-sign]
../../src/gdb/expprint.c:205:2: note: expected ‘const gdb_byte *’ but argument is of type ‘char *’

cc1: all warnings being treated as errors
make: *** [expprint.o] Error 1
../../src/gdb/utils.c: In function ‘host_char_to_target’:
../../src/gdb/utils.c:1474:9: error: pointer targets in passing argument 3 of ‘convert_between_encodings’ differ in signedness [-Werror=pointer-sign]

../../src/gdb/varobj.c: In function ‘value_get_print_value’:
../../src/gdb/varobj.c:2934:8: error: pointer targets in return differ in signedness [-Werror=pointer-sign]
../../src/gdb/varobj.c:2968:12: error: pointer targets in assignment differ in signedness [-Werror=pointer-sign]
../../src/gdb/varobj.c:2971:3: error: pointer targets in return differ in signedness [-Werror=pointer-sign]
cc1: all warnings being treated as errors
make: *** [varobj.o] Error 1

As with the previous patch, the encoding conversion code works with
gdb_byte arrays as the generic buffers that hold strings of any
encoding/width.  This patch adds casts where appropriate.

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

	* c-lang.c (parse_one_string): Cast argument to gdb_byte *.
	* expprint.c (print_subexp_standard): Likewise.
	* utils.c (host_char_to_target): Likewise.
	* valprint.c (generic_emit_char, generic_printstr): Likewise.
	* varobj.c (value_get_print_value): Change type of local to char*.
	Cast it gdb_byte * in call to language printer.
2013-03-07 19:24:32 +00:00
Pedro Alves 2898e56054 charset.c: fix -Wpointer-sign
$ make WERROR_CFLAGS="-Wpointer-sign -Werror" charset.o 2>&1 1>/dev/null
../../src/gdb/charset.c: In function ‘wchar_iterate’:
../../src/gdb/charset.c:665:13: error: pointer targets in assignment differ in signedness [-Werror=pointer-sign]
../../src/gdb/charset.c:691:13: error: pointer targets in assignment differ in signedness [-Werror=pointer-sign]
../../src/gdb/charset.c:706:12: error: pointer targets in assignment differ in signedness [-Werror=pointer-sign]

The encoding conversion code works with gdb_byte arrays as the generic
buffers that hold strings of any encoding/width.  Changing the type of
this field to gdb_byte* removes the need for one cast, and makes
everything work with the same types.  That's good -- WRT to strings,
"char *" is (almost) consistently throughout GDB only used for
ascii-ish strings.

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

	* charset.c (struct wchar_iterator) <input>: Change type to 'const
	gdb_byte *'.
	(make_wchar_iterator): Remove cast to char*.
	(wchar_iterate): Change type of local.
2013-03-07 19:10:46 +00:00
Pedro Alves a09b444817 regcache.c: fix -Wpointer-sign
$ make WERROR_CFLAGS="-Wpointer-sign -Werror" regcache.o 2>&1 1>/dev/null
../../src/gdb/regcache.c: In function ‘regcache_xmalloc_1’:
../../src/gdb/regcache.c:228:2: error: pointer targets in assignment differ in signedness [-Werror=pointer-sign]
../../src/gdb/regcache.c:235:2: error: pointer targets in assignment differ in signedness [-Werror=pointer-sign]
cc1: all warnings being treated as errors

regcache->register_status is "signed char".

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

	* regcache.c (regcache_xmalloc_1): Call XCALLOC with signed char
	for 'regcache->register_status'.
2013-03-07 18:59:54 +00:00
Pedro Alves c2d6a67509 Fix typo. 2013-03-07 18:53:40 +00:00
Pedro Alves 20ced3e488 breakpoint.c: fix -Wpointer-sign
$ make WERROR_CFLAGS="-Wpointer-sign -Werror" breakpoint.o 2>&1 1>/dev/null
../../src/gdb/breakpoint.c: In function ‘breakpoint_xfer_memory’:
../../src/gdb/breakpoint.c:1578:2: error: pointer targets in passing argument 3 of ‘gdbarch_breakpoint_from_pc’ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/defs.h:644:0,
                 from ../../src/gdb/breakpoint.c:20:
../../src/gdb/gdbarch.h:495:25: note: expected ‘int *’ but argument is of type ‘unsigned int *’

target_info.placed_size is an 'int', and gdbarch_breakpoint_from_pc
takes an int too.

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

	* breakpoint.c.c (breakpoint_xfer_memory): Change type of local to
	int.
2013-03-07 18:50:53 +00:00
Pedro Alves fe106009bd stap-probe.c: fix -Wpointer-sign
$ make WERROR_CFLAGS="-Wpointer-sign -Werror" stap-probe.o 2>&1 1>/dev/null
../../src/gdb/stap-probe.c: In function ‘handle_stap_probe’:
../../src/gdb/stap-probe.c:1306:19: error: pointer targets in assignment differ in signedness [-Werror=pointer-sign]
cc1: all warnings being treated as errors
make: *** [stap-probe.o] Error 1

provider is a string, so it's rightfully a char*.  'data' holds raw
bytes (bfd_byte), so a cast is the right thing to do.

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

	* stap-probe.c (handle_stap_probe): Add cast to char*.
2013-03-07 18:45:51 +00:00
Pedro Alves 8ac2c12b84 linux-record.c:record_linux_system_call: fix -Wpointer-sign
$ make WERROR_CFLAGS="-Wpointer-sign -Werror" linux-record.o 2>&1 1>/dev/null
...
../../src/gdb/linux-record.c: In function ‘record_linux_system_call’:
../../src/gdb/linux-record.c:1152:9: error: pointer targets in passing argument 3 of ‘regcache_raw_read_signed’ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/linux-record.c:23:0:
../../src/gdb/regcache.h:76:3: note: expected ‘long int *’ but argument is of type ‘long unsigned int *’
../../src/gdb/linux-record.c:1186:13: error: pointer targets in passing argument 3 of ‘regcache_raw_read_signed’ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/linux-record.c:23:0:
../../src/gdb/regcache.h:76:3: note: expected ‘long int *’ but argument is of type ‘long unsigned int *’

I believe the read_signed calls are correct, and the variables are in
the wrong.

Tested on x86_64 Fedora 17.

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

	* linux-record.c (record_linux_system_call) <gdb_sys_msgrcv,
	RECORD_MSGRCV>: Pass a signed variable to
	regcache_raw_read_signed, instead of an unsigned one.
2013-03-07 18:29:05 +00:00
Pedro Alves 99f0a309a9 remote-notif.[h|c]:notif_debug: Change type to int.
notif_debug is installed as variable of a "signed" command:

  add_setshow_boolean_cmd ("notification", no_class, &notif_debug,
                           _("\

and:

command.h:extern void add_setshow_boolean_cmd (char *name,
command.h-                                   enum command_class class,
command.h-                                   int *var,

2013-03-07  Pedro Alves  <palves@redhat.com>

	* remote-notif.c (notif_debug): Change type to int.
	* remote-notif.h (notif_debug): Likewise.
2013-03-07 17:52:58 +00:00
Pedro Alves 964b8317b4 ser-tcp.c:tcp_retry_limit: Change type to unsigned int.
tcp_retry_limit is installed as variable of an unsigned command:

  add_setshow_uinteger_cmd ("connect-timeout", class_obscure,
                            &tcp_retry_limit, _("\

and I found no uses of the variable treating it as signed (like < 0
checks or some such).

2013-03-07  Pedro Alves  <palves@redhat.com>

	* ser-tcp.c (tcp_retry_limit): Change type to unsigned int.
2013-03-07 17:36:25 +00:00
Pedro Alves f0cc8ad436 hex2bin, bin2hex: move declarations to header.
Move the declarations to a header, rather than declaring them in
(multiple) .c files.

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

	* remote.c (hex2bin, bin2hex): Move extern declarations to ...
	* remote.h (hex2bin, bin2hex): ... here.
	* tracepoint.c (hex2bin, bin2hex): Remove extern declarations.
2013-03-07 17:29:32 +00:00
Yao Qi e64f749990 gdb/gdbserver/
* tracepoint.c (cur_action, cur_step_action): Make them unsigned.
	(cmd_qtfp): Initialize cur_action and cur_step_action 0 instead
	of -1.
	(cmd_qtsp): Adjust condition.  Do post increment.
	Set cur_action and cur_step_action back to 0.
2013-03-07 13:17:28 +00:00
Eli Zaretskii 77dec115af * utils.c (initialize_utils): Improve doc strings of "set/show
width", "set/show height", and "set/show pagination".
2013-03-07 12:26:05 +00:00
Pedro Alves f0ae6fc35c PR gdb/15236: gdbserver write to linux memory with zero length corrupts stack
PROBLEM:

The function linux_write_memory () in linux-low.c allocates a buffer
on the stack to hold a copy of the data to be written.

  register PTRACE_XFER_TYPE *buffer = (PTRACE_XFER_TYPE *)
    alloca (count * sizeof (PTRACE_XFER_TYPE));

"count" is the number of bytes to be written, rounded up to the
nearest multiple of sizeof (PTRACE_XFER_TYPE) and allowing for not
being an aligned address. The function later uses

  buffer[0] = ptrace (PTRACE_PEEKTEXT, pid,
                      (PTRACE_ARG3_TYPE) (uintptr_t) addr, 0);

The problem is that this function can be called to write zero bytes on
an aligned address, for example when receiving an X packet of length 0
(used to test if 8-bit write is supported). Under these circumstances,
count can be zero.

Since in this case, buffer[0] may never have been allocated, the stack
is corrupted and gdbserver may crash.

SOLUTION:

Writing zero bytes should always succeed. The patch below returns
successfully early if the length is zero, so avoiding the stack
corruption.

Verified on the ARC GDB 7.5.1 port.

2013-03-07  Jeremy Bennett  <jeremy.bennett@embecosm.com>

	PR server/15236

	* linux-low.c (linux_write_memory): Return early success if LEN is
	zero.
2013-03-07 09:47:57 +00:00
Keith Seitz 741d92cf39 * ax-gdb.c (gen_printf): Make FORMAT const.
* ax-gdb.h (gen_printf): Likewise.
	* ax-general.c (ax_string): Make STR const.
	* ax.h (ax_string): Likewise.
2013-03-07 00:48:25 +00:00
gdbadmin 31c620b0bc *** empty log message *** 2013-03-07 00:00:34 +00:00
Doug Evans 7b6c814ed7 * elfread.c (elf_symfile_read): Move debugging printf to more
logical location.
2013-03-06 21:20:02 +00:00
Pedro Alves 634334ab5e Garbage collect py-utils.c:target_string_to_unicode.
The strlen in this function looked suspicious, for the function
documents that STR is in the target's charset (what if it is utf-32,
etc.).

On closer inspection, nothing is calling the function, and it's been
that way ever since the function was added.

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

	* python/py-utils.c (target_string_to_unicode): Delete function.
	* python/python-internal.h (target_string_to_unicode): Delete
	declaration.
2013-03-06 19:51:18 +00:00
Pedro Alves 049109b007 tstatus.exp: use UNSUPPORTED for optional features that are not supported
The current tstatus.exp tests shows PASSes if either the target
support or not the optional tstatus bits:

 PASS: gdb.trace/tstatus.exp: tstatus does not report trace stop reason
 PASS: gdb.trace/tstatus.exp: tstatus reports trace stop reason

The former (and any other similar case) should be UNSUPPORTED rather
than PASS.  That'd make it much easier to spot actually problems with
the test (e.g., the one Yao's previous patch addressed), along with
regressions and progressions.

The "not supported" paths in tstatus.exp explicitly check for output
you'd get if the feature wasn't supported, so real unexpected failures
will still be caught as FAILs.

So now e.g., where we wanted to check if tstatus reports the trace
stop reason, and if the target does support it, we get

 PASS: tstatus reports trace stop reason

if the target actually reports what we'd expect if the trace stop
reason isn't supported, we get:

 UNSUPPORTED: tstatus reports trace stop reason

and if the target reports something else unexpected, we get:

 FAIL: tstatus reports trace stop reason

That has the added bonus that the test string is always the same and
only the test results change (PASS/FAIL/UNSUPPORTED), which makes it
easier for testers see regressions, compared to the previous:

 -PASS: gdb.trace/tstatus.exp: tstatus reports trace stop reason
 +PASS: gdb.trace/tstatus.exp: tstatus does not report trace stop reason

which clearly easily goes by unnoticed, as evidenced by the existing
problem Yao's previous patch addressed.

Tested on x86_64 Fedora 17.

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

	* gdb.trace/tstatus.exp (run_trace_experiment): When the target
	doesn't support the tested optional feature, call "unsupported"
	with the same test message as the "pass" case, instead of calling
	"pass" with a different message.  Use the same text for the "fail"
	cases too.
2013-03-06 12:13:41 +00:00
Pierre Muller e482a1a770 * linespec.c (get_current_search_block): ARI fix, use (void)
for empty parameter list.
2013-03-06 11:05:55 +00:00
Yao Qi 4aa54120ee gdb/testsuite/
* gdb.trace/tstatus.exp: Remove the invocation of
	gdb_load_shlibs, gdb_compile, clean_restart and runto_main.
	(test_tracepoints): Don't set fast tracepoint.
	(top level): Don't check agent library is loaded or not.
2013-03-06 01:03:40 +00:00
Yao Qi b8b71e6335 gdb/testsuite/
* gdb.trace/tstatus.exp (run_trace_experiment): Escape
	parentheses by "\\".
2013-03-06 00:59:55 +00:00
gdbadmin 5f3f50be8b *** empty log message *** 2013-03-06 00:00:03 +00:00
Doug Evans 4eeaa230f4 * ada-lang.c (ada_lookup_symbol_list_worker): New function, contents
of old ada_lookup_symbol_list.  In !full_search case, don't
	search superblocks.
	(ada_lookup_symbol_list): Delete arg full_search, all callers
	updated.  Call ada_lookup_symbol_list_worker.
	(ada_iterate_over_symbols): Call ada_lookup_symbol_list_worker.
	* ada-lang.h (ada_lookup_symbol_list): Update.
	* language.h (language_defn): Update comment for
	la_iterate_over_symbols.
	* linespec.c (iterate_over_file_blocks): New function.
	(iterate_over_all_matching_symtabs): Call it.
	(lookup_prefix_sym): Ditto.
	(get_current_search_block): New function.
	(get_search_block): Delete.
	(find_label_symbols): Call get_current_search_block.
	(add_matching_symbols_to_info): Call iterate_over_file_blocks.
	* symtab.c (iterate_over_symbols): Don't search superblocks.
2013-03-05 21:15:34 +00:00
Corinna Vinschen 334ad4a8e4 Fix ChangeLog entry. 2013-03-05 15:18:10 +00:00
Yao Qi b69b1fb10d gdb/
* cli/cli-decode.c (add_setshow_zuinteger_unlimited_cmd): Change
	parameter VAR's type from "unsigned int" to "int".
	* command.h (var_zuinteger_unlimited): Update its comments.
	(add_setshow_zuinteger_unlimited_cmd): Update the declaration.
2013-03-05 14:23:23 +00:00
Corinna Vinschen 3c095f49ce * NEWS: Mention new target x86_64-*-cygwin*. 2013-03-05 13:39:00 +00:00
Corinna Vinschen b5b0b0afd0 * configure.host: Add x86_64-*-cygwin* as host.
* configure.tgt: Add x86_64-*-cygwin* as target.
	* config/i386/cygwin64.mh: New file.

	* gdbserver/configure.srv: Add x86_64-*-cygwin* as target.
2013-03-05 13:37:11 +00:00
gdbadmin da797b631b *** empty log message *** 2013-03-05 00:00:03 +00:00
Jan Kratochvil f6f99966e9 gdb/
* linespec.c (decode_line_2): Fix duplicate request off by two message.
2013-03-04 19:38:02 +00:00
Jan Kratochvil 33f448b11e gdb/
* linespec.c (struct linespec_canonical_name): New.
	(struct linespec_state): Change canonical_names type to it.
	(add_sal_to_sals): Change variable canonical_name to canonical.  Change
	xrealloc element size.  Initialize the different CANONICAL fields.
	(canonical_to_fullform): New.
	(filter_results): Use it.  Add variables canonical, fullform and
	cleanup.
	(struct decode_line_2_item, decode_line_2_compare_items): New.
	(decode_line_2): Remove variables iter and item_names, add variables
	items and items_count.  Modify the code for these new variables.

gdb/testsuite/
	* gdb.linespec/base/one/thefile.cc (twodup): New.
	(m): Call it.
	* gdb.linespec/base/two/thefile.cc (dupname): New.
	(n): Call it.
	* gdb.linespec/break-ask.exp: New file.
	* gdb.linespec/lspec.cc (body_elsewhere): New comment marker.
2013-03-04 19:30:28 +00:00
Corinna Vinschen feb1472522 * coff-pe-read.c (read_pe_exported_syms): Don't return without
calling do_cleanup.
2013-03-04 15:09:46 +00:00
Hui Zhu e83b17baa4 2013-03-04 Luis Machado <lgustavo@codesourcery.com>
* tracepoint.c (build_traceframe_info): Add code for byte order.
2013-03-04 13:52:46 +00:00
gdbadmin 674330e8a7 *** empty log message *** 2013-03-04 00:00:03 +00:00
gdbadmin b1696c92b0 *** empty log message *** 2013-03-03 00:00:33 +00:00
Kevin Buettner 8dddcae8f0 Revise ChangeLog comment for recently committed change. 2013-03-02 18:34:13 +00:00
Kevin Buettner a2d13a0d5b * v850-tdep.c: (v850e2_register_name): (v850e2_reg_names):
Revise system register names to match current V850E2M
	architecture specifications.
2013-03-02 18:26:30 +00:00
Jiong Wang d79e58d83c gdb/
* tilegx-tdep.c (tilegx_analyze_prologue): Limit bundle reading
     to END_ADDR.
     (tilegx_skip_prologue): Limit prologue analysis to section end
2013-03-02 01:34:40 +00:00
gdbadmin 0f4bfba480 *** empty log message *** 2013-03-02 00:00:03 +00:00
Jan Kratochvil c4be516571 gdb/
* dwarf2loc.c (call_site_find_chain_1): New variable save_callee_pc,
	use it.
2013-03-01 21:18:21 +00:00
Pedro Alves e362b51003 Use gdb_byte for bytes from the program being debugged.
gdb_byte should be used for bytes from the program being debugged.  We
have many places using char or unsigned char instead all over the
existing ports, and more ends up added over time due to copy/paste as
new code is based on old code.

I've greped the tree for "char buf[", and fixed all I found.

Tested by building with --enable-targets=all.

2013-03-01  Pedro Alves  <palves@redhat.com>

	Use gdb_byte for bytes from the program being debugged.

	* arm-tdep.c (arm_store_return_value, arm_get_longjmp_target):
	Change type of local 'buf' to gdb_byte.
	* avr-tdep.c (avr_frame_prev_register, avr_push_dummy_call): Likewise.
	* bfin-tdep.c (bfin_push_dummy_call): Likewise.
	* cris-tdep.c (cris_sigcontext_addr)
	(cris_sigtramp_frame_unwind_cache): Likewise.
	* frv-linux-tdep.c (frv_linux_pc_in_sigtramp)
	(frv_linux_sigcontext_reg_addr, frv_linux_sigtramp_frame_cache):
	Likewise.
	* frv-tdep.c (frv_pseudo_register_write, frv_analyze_prologue): Likewise.
	* hppa-hpux-tdep.c (hppa32_hpux_find_global_pointer)
	(hppa32_hpux_search_dummy_call_sequence)
	(hppa_hpux_supply_save_state): Likewise.
	* hppa-linux-tdep.c (insns_match_pattern)
	(hppa_linux_find_global_pointer): Likewise.
	* hppa-tdep.c (hppa_in_function_epilogue_p)
	(skip_prologue_hard_way, hppa_frame_cache): Likewise.
	* i386-nto-tdep.c (i386nto_sigcontext_addr): Likewise.
	* i386fbsd-tdep.c (i386fbsd_supply_uthread)
	(i386fbsd_collect_uthread): Likewise.
	* ia64-hpux-tdep.c (ia64_hpux_push_dummy_code): Likewise.
	* ia64-linux-tdep.c (ia64_linux_sigcontext_register_address): Likewise.
	* ia64-tdep.c (examine_prologue, ia64_frame_cache)
	(ia64_frame_prev_register, ia64_sigtramp_frame_cache)
	(ia64_sigtramp_frame_prev_register, ia64_access_reg)
	(ia64_access_rse_reg, ia64_libunwind_frame_this_id)
	(ia64_libunwind_frame_prev_register)
	(ia64_libunwind_sigtramp_frame_this_id)
	(ia64_find_global_pointer_from_dynamic_section)
	(find_extant_func_descr, find_func_descr, ia64_dummy_id)
	(ia64_unwind_pc): Likewise.
	* iq2000-tdep.c (iq2000_store_return_value): Likewise.
	* m68hc11-tdep.c (m68hc11_push_dummy_call)
	(m68hc11_extract_return_value): Likewise.
	* m68klinux-nat.c (fetch_register, store_register): Likewise.
	* mep-tdep.c (mep_pseudo_cr32_read, mep_pseudo_cr32_write)
	(mep_get_insn, mep_push_dummy_call): Likewise.
	* mips-linux-tdep.c (mips_linux_get_longjmp_target)
	(mips_linux_in_dynsym_stub): Likewise.
	* mn10300-tdep.c (mep_pseudo_cr32_write): Likewise.
	* ppc-linux-nat.c (fetch_register, store_register): Likewise.
	* regcache.c (dump_endian_bytes): Change type of parameter 'buf'
	to gdb_byte.
	* remote-mips.c (mips_set_register): Likewise.
	* remote-sim.c (gdbsim_fetch_register): Likewise.
	* score-tdep.c (score7_fetch_inst): Change type of parameter
	'memblock' and local 'buf' to gdb_byte.
	(score7_malloc_and_get_memblock): Change return type to gdb_byte.
	Change type of local 'buf' to gdb_byte.  Adjust.
	(score7_adjust_memblock_ptr): Change type of parameter 'memblock'
	to gdb_byte**.
	(score7_analyze_prologue): Change type of 'memblock' and
	'memblock_ptr' locals to gdb_byte*.
	* sh64-tdep.c (sh64_extract_return_value)
	(sh64_store_return_value): Change type of local 'buf' to gdb_byte.
	* solib-darwin.c (darwin_current_sos, darwin_read_exec_load_addr):
	* solib-pa64.c (pa64_solib_create_inferior_hook)
	(pa64_open_symbol_file_object): Remove local 'buf'.
	* solib-som.c (som_solib_create_inferior_hook, link_map_start)
	(som_open_symbol_file_object): Likewise.
	* solib-spu.c (spu_current_sos): Likewise.
	* spu-linux-nat.c (spu_fetch_inferior_registers): Likewise.
	* spu-multiarch.c (parse_spufs_run, spu_fetch_registers)
	(spu_store_registers): Likewise.
	* target.c (debug_print_register): Likewise.
	* tic6x-tdep.c (tic6x_get_longjmp_target): Likewise.
	* xstormy16-tdep.c (xstormy16_store_return_value)
	(xstormy16_push_dummy_call, xstormy16_resolve_jmp_table_entry)
	(xstormy16_find_jmp_table_entry): Likewise.
2013-03-01 15:38:27 +00:00
Jiong Wang 75cc61ca4a Revise the commit date of my ChangeLog entry. 2013-03-01 11:02:23 +00:00
Jiong Wang 61d8bd0e17 Implement get_longjmp_target for tilegx.
gdb/
      * tilegx-tdep.c (tilegx_get_longjmp_target): New function.
      (tilegx_gdbarch_init): Install it.
2013-03-01 10:45:28 +00:00
Jiong Wang c32f23033e Add missing file from the previous commit.
(forget to "cvs add" it)
2013-03-01 06:42:18 +00:00
gdbadmin cd143fbbea *** empty log message *** 2013-03-01 00:00:33 +00:00
Tom Tromey ddb08e9caa * python/py-arch.c (archpy_disassemble): Use PyInt_Check and
PyLong_Check.
2013-02-28 20:14:08 +00:00
Doug Evans 62d7fb5171 * python/py-finishbreakpoint.c (bpfinishpy_init): gcc -Wall lint.
* python/python.c (gdbpy_find_pc_line): Ditto.
2013-02-28 20:01:10 +00:00
Tom Tromey c4a9e8b4e3 * contrib/excheck.py: New file.
* contrib/exsummary.py: New file.
	* contrib/gcc-with-excheck: New file.
2013-02-28 19:28:25 +00:00
Tom Tromey 7f6a5dde44 * python/python.c (gdbpy_print_stack): Call begin_line and
fprintf_filtered inside TRY_CATCH.
2013-02-28 19:25:42 +00:00
Tom Tromey 9e974e552d * python/python.c (gdbpy_find_pc_line): Call find_pc_line
inside TRY_CATCH.
2013-02-28 19:23:57 +00:00
Tom Tromey dd5fa3e772 * py-finishbreakpoint.c (bpfinishpy_init): Reorganize to call
frame_object_to_frame_info inside TRY_CATCH.
2013-02-28 19:21:44 +00:00
Tom Tromey 86a3263fff * py-block.c (gdbpy_block_for_pc): Call block_for_pc inside
TRY_CATCH.
2013-02-28 19:01:54 +00:00
Tom Tromey 81b52a3ae5 * objfiles.h (ALL_PSPACE_OBJFILES): Remove trailing backlash. 2013-02-28 19:00:31 +00:00
Tom Tromey 589bc9275a * configure.ac: Invoke AC_SYS_LARGEFILE.
* configure, config.in: Rebuild.
2013-02-28 16:51:19 +00:00
Corinna Vinschen dfe0758235 * win32-low.c: Throughout, fix format strings and casts of
printf-like functions to avoid type related warnings on all
	platforms.
	(get_child_debug_event): Print dwDebugEventCode as hex since
	that's how it's usually documented.
2013-02-28 09:09:02 +00:00
Yao Qi 736cd58526 gdb/gdbserver/
* tracepoint.c (cmd_qtbuffer): Call phex_nz instead of
	pulongest.
2013-02-28 01:21:08 +00:00
Yao Qi 1c942fb948 gdb/gdbserver/
* gdb.trace/report.exp: Move some code to ...
	(use_collected_data): New.
	(top level): Call use_collected_data once on the live target.
	Save at file of the current trace session, load it with target
	tfile, and call use_collected_data again.
2013-02-28 00:42:20 +00:00
gdbadmin 0e4768ddaa *** empty log message *** 2013-02-28 00:00:34 +00:00
Corinna Vinschen d50a0ce273 * windows-nat.c: Throughout, fix format strings and casts of
printf-like functions to avoid type related warnings on all
	platforms.
	(handle_output_debug_string): Fetch context information address
	from debug string using string_to_core_addr.
2013-02-27 19:42:26 +00:00
Jan Kratochvil 5b967901c5 gdb/testsuite/
* gdb.threads/fork-thread-pending.c (main): Add alarm.
2013-02-27 18:48:23 +00:00
Jan Kratochvil 6447023f09 gdb/testsuite/
* gdb.base/valgrind-infcall.exp (valgrind_pid): New variable.
	Add final kill of ${valgrind_pid}.
2013-02-27 18:46:52 +00:00
Jiong Wang e1f58301dd gdb/
* regformats/reg-tilegx.dat (name): Change abi name to "tilegx".
	* regformats/reg-tilegx32.dat: New.

  gdbserver/

	* Makefile.in (clean): Remove reg-tilegx.c, reg-tilegx32.c.
	(reg-tilegx32.c): New rule.
	* configure.srv (tilegx-*-linux*): Add reg-tilegx32.o to srv_regobj.
	* linux-tile-low.c (tile_arch_setup): New function.  Invoke
	different register info initializer according to elf class.
	(init_registers_tilgx32): New function.  The tilegx32 register info
	initializer.
	(tile_fill_gregset): Use "uint_reg_t" to represent register size.
	(tile_store_gregset): Likewise.
2013-02-27 14:58:18 +00:00
Jiong Wang 4fcd89fc75 gdb/
* configure.tgt (tilegx-*-linux*): Enable gdbserver.
2013-02-27 14:49:15 +00:00
Jiong Wang 748d24e643 gdb/
* configure.tgt (tilegx-*-linux*): Replace whitespace with tab.
2013-02-27 14:47:13 +00:00
Yao Qi d171ca7803 gdb/gdbserver/
* server.c (process_point_options): Print debug message when
	debug_threads is true.
2013-02-27 13:31:38 +00:00
Yao Qi 6c8e944d79 gdb/
2013-02-27  Yao Qi  <yao@codesourcery.com>
	    Pedro Alves  <palves@redhat.com>

	* tracepoint.c (tfile_trace_find): For tfind
    	pc/tp/range/outside, look for the next trace frame instead of
    	always starting from frame 0.
2013-02-27 01:39:26 +00:00
gdbadmin 32cc08a209 *** empty log message *** 2013-02-27 00:00:04 +00:00
Anthony Green acd7db3006 Add moxie-*-rtems* support. 2013-02-26 22:12:47 +00:00
Yao Qi 282bbdf358 gdb/gdbserver/
* tracepoint.c (cmd_qtbuffer): Don't set '\0' in OWN_BUF.
2013-02-26 14:11:58 +00:00
gdbadmin b81efddd06 *** empty log message *** 2013-02-26 00:00:37 +00:00
Pedro Alves 025e6dce58 Tweak warning output on Linux kernels with broken i386 NX support.
The "you have broken" bit of this text reads to me as if I had broken
it myself somehow.  This patch eliminates that ambiguity.

2013-02-25  Pedro Alves  <palves@redhat.com>

	* common/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Change
	warning text.
2013-02-25 17:32:06 +00:00
gdbadmin a4e6529be5 *** empty log message *** 2013-02-25 00:00:03 +00:00
Maciej W. Rozycki ca9c94efe7 * mips-tdep.c (mips32_scan_prologue): Reset frame_offset to zero
if $fp is used as the virtual frame pointer.
2013-02-24 12:54:04 +00:00
gdbadmin 95ab2206e0 *** empty log message *** 2013-02-24 00:00:36 +00:00
gdbadmin 5e2091fa63 *** empty log message *** 2013-02-23 00:00:03 +00:00
Alan Modra 24c274a133 * elfread.c (elf_symtab_read): Do not use udata.p here to find
symbol size.
	* ppc64-tdep.c (ppc64_elf_make_msymbol_special): New function.
	* ppc64-tdep.h (ppc64_elf_make_msymbol_special): Declare.
	* ppc-linux-tdep.c (ppc_linux_init_abi): Set up to use the above.
	* ppcfbsd-tdep.c (ppcfbsd_init_abi): Likewise.
2013-02-22 23:24:24 +00:00
Jan Kratochvil bfada1897a gdb/
Code cleanup.
	* elfread.c (build_id_bfd_get): Make the return type const.
	(build_id_verify): Make the check parameter const.
	(build_id_to_debug_filename): Make the build_id parameter and variable
	data const.
	(find_separate_debug_file_by_buildid): Make the variable build_id const.
2013-02-22 16:40:56 +00:00
gdbadmin 757b8d9405 *** empty log message *** 2013-02-22 00:00:03 +00:00
Tom Tromey d57350ea35 * gdb.texinfo: Remove bad @syncodeindex.
(Values From Inferior, Types In Python, Inferiors In Python)
	(Events In Python, Threads In Python, Frames In Python, Blocks In
	Python, Symbols In Python, Symbol Tables In Python): Remove
	@tables.
	(Packets, General Query Packets, Tracepoint Packets)
	(Host I/O Packets): Use @w{} for empty @item.
2013-02-21 19:08:10 +00:00
Alan Modra c03551323c bfd/
* elf-bfd.h (struct elf_build_id): Extracted from..
	(struct elf_build_id_info): ..here.  Delete.
	(struct output_elf_obj_tdata): New, extracted from..
	(struct elf_obj_tdata): ..here.  Reorganize for better packing.
	Add "o" field.
	(elf_program_header_size): Reference tdata->o.
	(elf_seg_map, elf_next_file_pos, elf_eh_frame_hdr, elf_linker,
	elf_stack_flags, elf_shstrtab, elf_strtab_sec, elf_shstrtab_sec,
	elf_section_syms, elf_num_section_syms, elf_flags_init): Likewise.
	* elf.c (bfd_elf_allocate_object): Allocate output_elf_obj_tdata
	when opening bfd in any mode that might write.
	(_bfd_elf_write_object_contents): Use build_id field in
	output_elf_obj_tdata.
	(_bfd_elf_close_and_cleanup): Tweak elf_shstrtab test.
	(elfobj_grok_gnu_build_id): Adjust for elf_tdata changes.
gdb/
	* elfread.c (build_id_bfd_get): Adjust for elf_tdata changes.
ld/
	* emultempl/elf32.em (write_build_id, setup_build_id): Adjust
	for elf_tdata changes.
2013-02-21 04:35:22 +00:00
Siva Chandra Reddy 9f44fbc034 Add a new method 'disassemble' to gdb.Architecture class.
* python/py-arch.c (archpy_disassmble): Implementation of the
	new method gdb.Architecture.disassemble.
	(arch_object_methods): Add entry for the new method.

	* doc/gdb.texinfo (Architectures In Python): Add description
	about the new method gdb.Architecture.disassemble.

	* testsuite/gdb.python/py-arch.c: New test case
	* testsuite/gdb.python/py-arch.exp: New tests to test
	gdb.Architecture.disassemble
	* testsuite/gdb.python/Makefile.in: Add py-arch to the list of
	EXECUTABLES.
2013-02-21 01:46:57 +00:00
gdbadmin d373aa7be9 *** empty log message *** 2013-02-21 00:00:03 +00:00
Jiong Wang b74ea3eb01 gdb/
* MAINTAINERS (Write After Approval): Add myself to the list.
2013-02-20 07:45:14 +00:00
gdbadmin 286cc68d2d *** empty log message *** 2013-02-20 00:00:03 +00:00
Pedro Alves aca2255198 gdbserver:server.c - use unpack_varlen_hex to extract hex numbers.
Addresses, as most numbers in the RSP are hex encoded, with variable
length (that just means the width isn't specified, and there's no top
cap.  So they should be extracted with unpack_varlen_hex.

A couple spots in server.c are using strto(u)l, which doesn't work on
LLP64 targets.

This patch fixes it.

Tested on x86_64 Fedora 17.

2013-02-19  Pedro Alves  <palves@redhat.com>
	    Kai Tietz <ktietz@redhat.com>

	PR gdb/15161

	* server.c (handle_query) <CRC check>: Use unpack_varlen_hex
	instead of strtoul to extract address from packet.
	(process_serial_event) <'z'>: Likewise.
2013-02-19 20:52:57 +00:00
Pedro Alves 61a672f17d Garbage collect struct monitor_ops::load_routine.
While touching monitor_load in a previous patch, I noticed this method
is no longer set to anything other than NULL in the tree, so we can
remove it.

Tested by building with --enable-targets=all.

2013-02-19  Pedro Alves  <palves@redhat.com>

	Garbage collect 'struct monitor_ops'::load_routine.

	* monitor.h (struct monitor_ops) <load_routine>: Remove field.
	* monitor.c (monitor_load): No longer call
	current_monitor->load_routine.
	* dbug-rom.c (init_dbug_cmds): Don't set 'load_routine'.
	* m32r-rom.c (init_m32r_cmds): Don't set 'load_routine'.
	* ppcbug-rom.c (init_ppc_cmds): Don't set 'load_routine'.
2013-02-19 19:41:28 +00:00
Pedro Alves 40e397df34 Harmonize this monitor_load with generic_load.
Harmonize this old-looking code with generic_load, which fixes several
issues.

2013-02-19  Pedro Alves  <palves@redhat.com>

	PR gdb/15161

	Harmonize with generic_load.

	* monitor.c: Include "readline/readline.h".
	(monitor_load): Rename parameter 'file' to 'args'.  Use build_argv
	instead of sscanf.  Use CORE_ADDR/strtoulst instead of unsigned
	long/strtol for the 'load_offset' local.  Error out if no argument
	is given or if too many arguments are given.  Tilde expand the
	passed in file name.
2013-02-19 19:27:21 +00:00
Kai Tietz f698ca8e12 PR gdb/15161
* symfile.c (load_section_data): Change type of load_offset
       to CORE_ADDR.
       (generic_load): User strtoulst instead of strtoul for conversion
       of load_offset.
2013-02-19 18:31:49 +00:00
Walter Lee 3361b059eb * tilegx-tdep.c (tilegx_analyze_prologue): add check for
for return address, "lr" register, saved on stack.
        * tilegx-tdep.c (tilegx_frame_cache): update "PC" reg
        after we invoke tilegx_analyze_prologue.
2013-02-19 16:22:42 +00:00
Walter Lee bb1bcd865b * tilegx-tdep.c (itilegx_gdbarch_init): char type should be signed. 2013-02-19 16:21:29 +00:00
Walter Lee 3e9d51302a * tilegx-tdep.c (tilegx_skip_prologue): Use skip_prologue_using_sal. 2013-02-19 16:20:47 +00:00
Walter Lee 4aaf25031b * tilegx-tdep.c (INT_SWINT_1_SIGRETURN): New macro.
(tilegx_write_pc): New function.
        (tilegx_cannot_reference_register): Return zero if REGNO
        is TILEGX_FAULTNUM_REGNUM.
        (tilegx_gdbarch_init): Add call to set_gdbarch_write_pc.
        (tilegx_register_name): Add handling of "faultnum" register.
        * tilegx-tdep.h (enum tilegx_regnum): Add TILEGX_FAULTNUM_REGNUM.
        * tilegx-linux-tdep.c (tilegx_linux_supply_regset): Add
        handling of TILEGX_FAULTNUM_REGNUM.
        * tilegx-linux-nat.c (regmap): Add entry for TILEGX_FAULTNUM_REGNUM.
2013-02-19 16:19:33 +00:00
Walter Lee bc23a95694 * tilegx-tdep.c (tilegx_push_dummy_call): args pushed on stack
should be aligned to 64bit.
2013-02-19 16:09:13 +00:00
Kai Tietz 42f45f1a89 * windows-nat.c (windows_xfer_memory): Fix debug-output
for LLP64.
2013-02-19 15:46:32 +00:00
Lei Liu 6ce4c1124b 2013-02-19 Lei Liu <lei.liu2@windriver.com>
* mips-linux-nat.c (mips64_linux_regsets_store_registers):
	Don't check DSP register number if HAVE_DSP is not set.
2013-02-19 07:50:30 +00:00
Lei Liu 13dbc7852d 2013-02-19 Lei Liu <lei.liu2@windriver.com>
* MAINTAINERS (Write After Approval): Add myself to the list.
2013-02-19 07:01:07 +00:00
gdbadmin 11e965c4b6 *** empty log message *** 2013-02-19 00:00:33 +00:00
Alan Modra 30e8ee25e3 include/
* bfdlink.h (struct bfd_link_info): Delete emit_note_gnu_build_id.
bfd/
	* configure.in: Bump version to 2.23.52.
	* elf-bfd.h (struct elf_build_id_info): New.
	(struct elf_obj_tdata): Delete after_write_object_contents,
	after_write_object_contents_info and build_id_size.  Make build_id
	a pointer to struct elf_build_id_info.
	* elf.c (_bfd_elf_write_object_contents): Style.  Update
	after_write_ibject_contents invocation.
	(elfobj_grok_gnu_build_id): Update for new build_id struct.  Don't
	allow zero size notes.
	* configure: Regenerate.
gdb/
	* elfread.c (struct build_id): Delete.  Use struct elf_build_id
	throughout file instead.
	(build_id_bfd_get): Update to use new elf_tdata build_id field.
	Don't xmalloc return value.
	(build_id_verify): Similarly.  Don't xfree.
	(build_id_to_debug_filename): Update.
	(find_separate_debug_file_by_buildid): Update, don't xfree.
ld/
	* emultempl/elf32.em (emit_note_gnu_build_id): New static var.
	Replace all info->emit_note_gnu_build_id refs.
	(id_note_section_size): Rename from
	gld${EMULATION_NAME}_id_note_section_size.
	(struct build_id_info): Delete.
	(write_build_id): Rename from
	gld${EMULATION_NAME}_write_build_id_section.
	Update elf_tdata usage.  Style, formatting.
	(setup_build_id): New function.
	(gld${EMULATION_NAME}_after_open): Use setup_build_id.
2013-02-18 23:50:32 +00:00
Tom Tromey 4c9ad8c2c0 PR gdb/15102:
* dwarf2read.c (read_subrange_type): Use result of
	'check_typedef'.
gdb/testsuite
	* gdb.dwarf2/subrange.exp: New file.
2013-02-18 21:04:28 +00:00
Yao Qi 4f3cee1ca1 gdb/gdbserver
* linux-bfin-low.c (the_low_target): Use NULL instead of 0.
2013-02-18 14:54:57 +00:00
gdbadmin bdeb34ba52 *** empty log message *** 2013-02-18 00:00:33 +00:00
gdbadmin 813402189e *** empty log message *** 2013-02-17 00:00:33 +00:00
Yao Qi 983dc440fe gdb/
2013-02-16  Yuanhui Zhang  <asmwarrior@gmail.com>

	* frame.c: Remove one extra white space after #include
	directive.
2013-02-16 08:57:48 +00:00
gdbadmin 1082a0c400 *** empty log message *** 2013-02-16 00:00:03 +00:00
Jan Kratochvil 7fb2b84a25 gdb/
* contrib/cc-with-tweaks.sh: Extend the comment for -p option.
2013-02-15 20:30:16 +00:00
Jan Kratochvil edceb2a99a gdb/
* gdb-gdb.gdb.in: Wrap set complaints, b internal_error, b info_command
	and dir commands into an if block.
2013-02-15 20:28:24 +00:00
Tom Tromey e81b7af881 2013-02-15 Sanimir Agovic <sanimir.agovic@intel.com>
* python/py-breakpoint (struct pybp_code):  Use int instead of
	enum type_code.
2013-02-15 17:12:29 +00:00
Hafiz Abid Qadeer f5911ea119 2013-02-15 Pedro Alves <pedro@codesourcery.com>
Hafiz Abid Qadeer  <abidh@codesourcery.com>

	gdb/
	* NEWS: Mention new field "trace-file".
	* tracepoint.c (trace_status_mi): Output "trace-file" field.
	(tfile_open): Record the trace file's filename in the trace
	status.
	(tfile_files_info): Mention the name of the trace file.
	Check the "filename" field explicitely.
	(trace_status_command): Explicitely check "filename" field.
	(trace_find_command): Ditto.
	(trace_find_pc_command): Ditto.
	(trace_find_tracepoint_command): Ditto.
	(trace_find_line_command): Ditto.
	(trace_find_range_command): Ditto.
	(trace_find_outside_command): Ditto.
	* tracepoint.h (struct trace_status) <from_file>: Rename it
	to "filename" and make it hold the trace file's filename
	instead of a boolean.
	* remote.c (remote_get_trace_status): Initialize "filename"
	field with NULL instead	of 0.

	gdb/doc/
	* gdb.texinfo (GDB/MI Tracepoint Commands) <-trace-status>:
	Document the "trace-file" field.

	gdb/testsuite/
	* gdb.trace/tfile.exp: Add test for -trace-status command.
2013-02-15 09:47:50 +00:00
Yao Qi 796cb314e7 gdb/
* remote.c: Fix a typo.
2013-02-15 03:37:12 +00:00