Commit Graph

37130 Commits

Author SHA1 Message Date
Pedro Alves 44a8b4df1d Add cast to exception_none
Fixes, in C++ mode:

 ../../src/gdb/common/common-exceptions.c:23:69: error: invalid conversion from ‘int’ to ‘return_reason’ [-fpermissive]
  const struct gdb_exception exception_none = { 0, GDB_NO_ERROR, NULL };
								      ^

(I considered adding an enum value for '0', but the code and comments
around return_reason and its uses explain how 0 is special/internal,
so I'm leaving it be.)

gdb/ChangeLog:
2015-10-29  Pedro Alves  <palves@redhat.com>

	* common/common-exceptions.c (exception_none): Add cast.
2015-10-29 12:55:01 +00:00
Pedro Alves e3bdafe2ba compile: Rename struct type_map_instance::gcc_type field
Fixes:

  src/gdb/compile/compile-c-types.c:36:12: error: declaration of ‘gcc_type type_map_instance::gcc_type’ [-fpermissive]
     gcc_type gcc_type;
	      ^
  In file included from src/gdb/../include/gcc-c-interface.h:23:0,
		   from src/gdb/compile/compile-internal.h:21,
		   from src/gdb/compile/compile-c-types.c:23:
  src/gdb/../include/gcc-interface.h:32:28: error: changes meaning of ‘gcc_type’ from ‘typedef long long unsigned int gcc_type’ [-fpermissive]
   typedef unsigned long long gcc_type;
			      ^
  src/gdb/compile/compile-c-types.c: In function ‘gcc_type convert_qualified(compile_c_instance*, type*)’:
  src/gdb/compile/compile-c-types.c:310:19: error: invalid conversion from ‘int’ to ‘gcc_qualifiers’ [-fpermissive]
		quals);
		     ^

gdb/ChangeLog:
2015-10-29  Pedro Alves  <palves@redhat.com>

	* compile/compile-c-types.c (struct type_map_instance)
	<gcc_type>: Rename to gcc_type_handle.
	(insert_type, convert_type): Adjust.
2015-10-29 12:55:01 +00:00
Pedro Alves 9c6595ab68 Don't assume break/continue inside a TRY block works
In C++, this:

	try
	  {
	    break;
	  }
	catch (..)
	  {}

is invalid.  However, because our TRY/CATCH macros support it in C,
the C++ version of those macros support it too.  To catch such
assumptions, this adds a (disabled) hack that maps TRY/CATCH to raw
C++ try/catch.  Then it goes through all instances that building on
x86_64 GNU/Linux trips on, fixing them.

This isn't strictly necessary yet, but I think it's nicer to try to
keep the tree in a state where it's easier to eliminate the TRY/CATCH
macros.

gdb/ChangeLog:
2015-10-29  Pedro Alves  <palves@redhat.com>

	* dwarf2-frame-tailcall.c (dwarf2_tailcall_sniffer_first): Don't
	assume that "break" breaks out of a TRY/CATCH.
	* python/py-framefilter.c (py_print_single_arg): Don't assume
	"continue" breaks out of a TRY/CATCH.
	* python/py-value.c (valpy_binop_throw): New function, factored
	out from ...
	(valpy_binop): ... this.
	(valpy_richcompare_throw): New function, factored
	out from ...
	(valpy_richcompare): ... this.
	* solib.c (solib_read_symbols): Don't assume "break" breaks out
	of a TRY/CATCH.
	* common/common-exceptions.h [USE_RAW_CXX_TRY]
	<TRY/CATCH/END_CATCH>: Define as 1-1 wrappers around try/catch.
2015-10-29 12:55:01 +00:00
Simon Dardis 93084fcd9b Move encoded as 'or' in binutils.
A patch (http://sourceware.org/ml/binutils/2015-07/msg00376.html)
submitted to binutils will be encoding move as an 'or' instruction over
[d]addu in assembly and various code stubs. This patch for gdb addresses
that change for the mips specific parts of gdb.

gdb/ChangeLog:

	* mips-linux-tdep.c (mips_linux_in_dynsym_stub): Recognise 'or'
	as move along with [d]addu.
2015-10-28 09:54:30 -07:00
Yao Qi 43cdf5aeb8 Pass noaliases_p to aarch64_decode_insn
Nowadays aarch64_decode_insn is a public interface used by both
opcodes and gdb.  However, its behaviour relies on a global variable
no_aliases, which isn't a good practise.  On the other hand, In default,
no_aliases is zero, but in GDB, we do want no alias when decoding
instructions for prologue analysis (patches to be posted), so that we
can handle both instructions "add" and "mov" (an alias of "add") as
"add".  The code in GDB can be simplified.

This patch adds a new argument in aarch64_decode_insn, and pass no_aliases
to it.  In GDB side, always pass 1 to it.

include/opcode:

2015-10-28  Yao Qi  <yao.qi@linaro.org>

	* aarch64.h (aarch64_decode_insn): Update declaration.

opcodes:

2015-10-28  Yao Qi  <yao.qi@linaro.org>

	* aarch64-dis.c	(aarch64_decode_insn): Add one argument
	noaliases_p.  Update comments.  Pass noaliases_p rather than
	no_aliases to aarch64_opcode_decode.
	(print_insn_aarch64_word): Pass no_aliases to
	aarch64_decode_insn.

gdb:

2015-10-28  Yao Qi  <yao.qi@linaro.org>

	* aarch64-tdep.c (aarch64_software_single_step): Pass 1 to
	aarch64_decode_insn.
2015-10-28 14:22:57 +00:00
Pedro Alves b80c305316 Make host_address_to_string/gdb_print_host_address cast parameter to 'void *'
Fixes a set of errors like:

 ../../src/gdb/symfile-debug.c: In function ‘int debug_qf_map_symtabs_matching_filename(objfile*, const char*, const char*, int (*)(symtab*, void*), void*)’:
 ../../src/gdb/symfile-debug.c:137:39: error: invalid conversion from ‘int (*)(symtab*, void*)’ to ‘const void*’ [-fpermissive]
	host_address_to_string (callback),
					^

Note this has to work with data and function pointers.  In C++11 we
may perhaps do something a bit safer, but we're not there yet, and I
don't think it really matters.  For now just always do a simple
C-style cast in host_address_to_string itself.  No point in adding a
void * cast to each and every caller.

gdb/ChangeLog:
2015-10-27  Pedro Alves  <palves@redhat.com>

	* common/print-utils.c (host_address_to_string): Rename to ...
	(host_address_to_string_1): ... this.
	* common/print-utils.h (host_address_to_string): Reimplement as
	wrapper around host_address_to_string_1.
	* utils.c (gdb_print_host_address): Rename to ...
	(gdb_print_host_address_1): ... this.
	* utils.h (gdb_print_host_address): Reimplement as wrapper macro
	around	host_address_to_string_1.
2015-10-27 17:33:01 +00:00
Pedro Alves d09f2c3fc1 target_read_memory&co: no longer return target_xfer_status
Years ago, these functions used to return errno/EIO.  Later, through a
series of changes that intended to remove native/remote differences,
they ended up returning a target_xfer_status in disguise.

Unlike target_xfer_partial&co, the point of target_read_memory&co is
to either fully succeed or fail.  On error, they always return
TARGET_XFER_E_IO.  So there's no real point in casting the return of
target_read_memory to a target_xfer_status to pass it to memory_error.
Instead, it results in clearer code to simply decouple
target_read_memory&co's return from target_xfer_status.

This fixes build errors like this in C++ mode:

 ../../src/gdb/corefile.c: In function ‘void read_stack(CORE_ADDR, gdb_byte*, ssize_t)’:
 ../../src/gdb/corefile.c:276:34: error: invalid conversion from ‘int’ to ‘target_xfer_status’ [-fpermissive]
      memory_error (status, memaddr);
				   ^
 ../../src/gdb/corefile.c:216:1: error:   initializing argument 1 of ‘void memory_error(target_xfer_status, CORE_ADDR)’ [-fpermissive]

gdb/ChangeLog:
2015-10-27  Pedro Alves  <palves@redhat.com>

	* alpha-tdep.c (alpha_read_insn): Always pass TARGET_XFER_E_IO to
	memory_error.  Rename local 'status' to 'res'.
	* c-lang.c (c_get_string): Always pass TARGET_XFER_E_IO to
	memory_error.
	* corefile.c (read_stack, read_code, write_memory): Always pass
	TARGET_XFER_E_IO to memory_error.
	* disasm.c (dis_asm_memory_error): Always pass TARGET_XFER_E_IO to
	memory_error.  Rename parameter 'status' to 'err'.
	(dump_insns): Rename local 'status' to 'err'.
	* mips-tdep.c (mips_fetch_instruction): Rename parameter 'statusp'
	to 'errp'.  Rename local 'status' to 'err'.  Always pass
	TARGET_XFER_E_IO to memory_error.
	(mips_breakpoint_from_pc): Rename local 'status' to 'err'.
	* target.c (target_read_memory, target_read_raw_memory)
	(target_read_stack, target_read_code, target_write_memory)
	(target_write_raw_memory): Return -1 on error instead of
	TARGET_XFER_E_IO.
	* valprint.c (val_print_string): Rename local 'errcode' to 'err'.
	Always pass TARGET_XFER_E_IO to memory_error.  Update comment.
2015-10-27 17:25:09 +00:00
Simon Marchi c519209250 guile: Change return value of gdbscm_with_guile for const char *
The documentation of gdbscm_with_guile says that it returns a statically
allocated string (IOW, a const char *).  We can reflect that in its
return value type, and get rid of C++ build errors.

Initially fixes:

/home/simark/src/binutils-gdb/gdb/guile/scm-disasm.c: In function ‘void* gdbscm_disasm_read_memory_worker(void*)’:
/home/simark/src/binutils-gdb/gdb/guile/scm-disasm.c:93:12: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
     return "seek error";

gdb/ChangeLog:

	* guile/guile-internal.h (gdbscm_with_guile): Change return
	types to const char *.
	* guile/scm-safe-call.c (gdbscm_with_guile): Likewise.
	(struct c_data) <func>: Likewise.
	(struct c_data) <result>: Change type to const char *.
	(scscm_eval_scheme_string): Change return type to
	const char *.
	(scscm_source_scheme_script): Likewise.
	(gdbscm_safe_eval_string): Change type of result variable to
	const char * and remove cast.
	(gdbscm_safe_source_script): Likewise.
	* guile/scm-disasm.c (gdbscm_disasm_read_memory_worker):
	Change return type to const char *.
	(gdbscm_disasm_read_memory): Change type of status to
	const char *.
2015-10-27 13:12:12 -04:00
Pedro Alves 79b289e2d8 source.c:openp: save/restore errno
openp's return is documented as:

~~~
   If a file is found, return the descriptor.
   Otherwise, return -1, with errno set for the last name we tried to open.  */
~~~

By inspection, I noticed that there are function calls after the ones
that first set errno, and those may clobber errno.  It's safer to save
errno when see an open fail, and restore it on exit.

Tested on x86_64 Fedora 20.

gdb/ChangeLog:
2015-10-27  Pedro Alves  <palves@redhat.com>

	* source.c (openp): New local 'last_errno'.  Use it to
	save/restore errno.
2015-10-27 16:03:24 +00:00
Pedro Alves 709b551853 psymtab.c: Add casts
... as needed for C++.

gdb/ChangeLog:
2015-10-27  Pedro Alves  <palves@redhat.com>

	* psymtab.c (dump_psymtab_addrmap_1): Add casts.
2015-10-27 15:06:04 +00:00
Simon Marchi e0d13cbd4b ctf.c: Fix int/enum implicit cast
This patch was taken directly from Pedro's branch.

Right now, SET_INT32_FIELD is used to set enum fields.  This works in C,
but not C++.  Therefore, define the new SET_ENUM_FIELD, which casts the
value to the right enum type.

gdb/ChangeLog:

	* ctf.c (SET_ENUM_FIELD): New macro.
	(ctf_read_status): Use it.
	(ctf_read_tp): Use it.
2015-10-27 10:54:21 -04:00
Simon Marchi c6486df5f1 Add scm_t_dynwind_flags casts
There is a handful of calls to

  scm_dynwind_begin (0);

where the parameter is an enum, scm_t_dynwind_flags.  In C++, we have no
choice but to add an explicit cast, since there is no enum value that
represents 0 (no flags set).

gdb/ChangeLog:

	* guile/scm-breakpoint.c (gdbscm_set_breakpoint_stop_x): Add
	scm_t_dynwind_flags casts.
	* guile/scm-cmd.c (gdbscm_parse_command_name): Likewise.
	* guile/scm-ports.c (gdbscm_open_memory): Likewise.
	* guile/scm-value.c (gdbscm_value_to_string): Likewise.
2015-10-27 09:34:30 -04:00
Simon Marchi 70b8286a97 Introduce ax_raw_byte and use it
This patch was taken directly from Pedro's branch.

ax_simple is used to append an agent expression operator to an agent
expression string.  Therefore, it takes an enum agent_op as input.
There is an instance where it's called to append a raw byte, unrelated
to the enum.  It makes the build fail in C++ mode.

This patch introduces ax_raw_byte for that purpose and uses it.

gdb/ChangeLog:

	* ax.h (ax_raw_byte): New declaration.
	* ax-general.c (ax_raw_byte): New function.
	(ax_simple): Use ax_raw_byte.
	* ax-gdb.c (gen_printf): Likewise.
2015-10-27 09:33:29 -04:00
Simon Marchi a480de357b ada-lang.h: Add cast in GROW_VECT
The assignment requires a cast in C++.  We only use this macro for
vectors of chars, so adding (char *) diretly will do for now.

gdb/ChangeLog:

	* ada-lang.h (GROW_VECT): Add cast.
2015-10-27 09:27:40 -04:00
Jan Kratochvil 5e2e7507b4 Fix access_to_packed_array.exp typos/errors
Running ./gdb.ada/access_to_packed_array.exp ...
ERROR: tcl error sourcing ./gdb.ada/access_to_packed_array.exp.
ERROR: extra characters after close-quote
    while executing
"gdb_test "print pack.a" "\\(0 => 1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\)")"
    (file "./gdb.ada/access_to_packed_array.exp" line 29)
    invoked from within
"source ./gdb.ada/access_to_packed_array.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source ./gdb.ada/access_to_packed_array.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""

Unrelated to the typos I have changed the print expectations s/"x"/" = x"/
as for example expectation "3" should not match " = 43".

2015-10-27  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.ada/access_to_packed_array.exp: Fix typos erroring the testfile.
2015-10-27 06:08:45 +01:00
Doug Evans a04a15f586 symtab.h (struct general_symbol_info> <ada_mangled>: Update comment.
gdb/ChangeLog:

	* symtab.h (struct general_symbol_info> <ada_mangled>: Update comment.
2015-10-26 20:24:16 -07:00
Simon Marchi d7f3ff3ea7 target.c: Add a cast and change a type
Fixes some errors in C++ build.

gdb/ChangeLog:

	* target.c (memory_xfer_partial): Change type of buf to gdb_byte
	pointer.
	(simple_search_memory): Cast return of memmem.
2015-10-26 22:07:27 -04:00
Simon Marchi bf6778dab2 stap-probe.c: Add casts
gdb/ChangeLog:

	* stap-probe.c (handle_stap_probe): Add (const char *) casts.
2015-10-26 22:04:10 -04:00
Simon Marchi c92444842b ctf_xfer_partial: Return TARGET_XFER_E_IO instead of -1 on error
Use the enum value instead of the corresponding int value.

gdb/ChangeLog:

	* ctf.c (ctf_xfer_partial): Return TARGET_XFER_E_IO instead of
	-1 on error.
2015-10-26 22:01:45 -04:00
Doug Evans 0fde2c536b PR symtab/17391 gdb internal error: assertion fails in regcache.c:178
gdb/ChangeLog:

	* dwarf2-frame.c (dwarf2_restore_rule): Call dwarf_reg_to_regnum
	instead of gdbarch_dwarf2_reg_to_regnum.
	(dwarf2_frame_cache): Ditto.
	(read_addr_from_reg): Call dwarf_reg_to_regnum_or_error instead of
	gdbarch_dwarf2_reg_to_regnum.
	(get_reg_value): Ditto.
	(dwarf2_fetch_cfa_info): Ditto.
	(dwarf2_frame_prev_register): Ditto.
	* dwarf2loc.c: #include "complaints.h".
	(dwarf_expr_read_addr_from_reg): Call dwarf_reg_to_regnum_or_error
	instead of gdbarch_dwarf2_reg_to_regnum.
	(dwarf_expr_get_reg_value): Ditto.
	(read_pieced_value): Ditto.
	(write_pieced_value): Ditto.
	(dwarf2_evaluate_loc_desc_full): Ditto.
	(dwarf_reg_to_regnum): New function.
	(throw_bad_regnum_error): New function.
	(dwarf_reg_to_regnum_or_error): Renamed from
	dwarf2_reg_to_regnum_or_errorChange to take a ULONGEST regnum.
	All callers updated.  Call throw_bad_regnum_error.
	(locexpr_regname): Improve text of bad register number.
	* dwarf2loc.h (dwarf_reg_to_regnum): Declare.
	(dwarf_reg_to_regnum_or_error): Update prototype.
	* dwarf2expr.c: #include "dwarf2loc.h".
	(dwarf_block_to_sp_offset): Call dwarf_reg_to_regnum instead of
	gdbarch_dwarf2_reg_to_regnum.
	* gdbarch.sh (dwarf2_reg_to_regnum): Add comment.
	* gdbarch.h: Regenerate.
	* amd64-tdep.c (amd64_dwarf_reg_to_regnum): Remove warning for bad
	register.
	* avr-tdep.c (avr_dwarf_reg_to_regnum): Ditto.
	* cris-tdep.c (cris_dwarf2_reg_to_regnum): Ditto.
	* bfin-tdep.c (bfin_reg_to_regnum): Fix error checking.
	* hppa-linux-tdep.c (hppa_dwarf_reg_to_regnum): Improve error checking.
	Remove warning for bad register.
	* hppa-tdep.c (hppa64_dwarf_reg_to_regnum): Ditto.
	* i386-tdep.c (i386_svr4_dwarf_reg_to_regnum): Renamed from
	i386_svr4_reg_to_regnum.  Return -1 for bad registers.
	(i386_svr4_reg_to_regnum): New function.
	(i386_gdbarch_init): Update call to set_gdbarch_dwarf2_reg_to_regnum.
	* microblaze-tdep.c (microblaze_dwarf2_reg_to_regnum): Don't assert
	on bad registers, return -1.
	* msp430-tdep.c (msp430_dwarf2_reg_to_regnum): Improve error checking.
	Remove warning for bad register.
	* nios2-tdep.c: Add static assert for NIOS2_NUM_REGS.
	(nios2_dwarf_reg_to_regnum): Fix off-by-one error.
	Remove warning for bad register.  Return -1 for bad register.
	* rl78-tdep.c (rl78_dwarf_reg_to_regnum): Don't flag an internal error
	for bad register, return -1.
	* rx-tdep.c (rx_dwarf_reg_to_regnum): Ditto.
	* m68k-tdep.c (m68k_dwarf_reg_to_regnum): Fix error result.
	* mep-tdep.c (mep_debug_reg_to_regnum): Ditto.
	* mips-tdep.c (mips_stab_reg_to_regnum): Ditto.
	(mips_dwarf_dwarf2_ecoff_reg_to_regnum): Ditto.
	* mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Remove warning
	for bad regs.
	* xtensa-tdep.c (xtensa_reg_to_regnum): Remove internal error for
	bad regs.  Fix error result.
	* stabsread.c (stab_reg_to_regnum): Watch for negative regno.
	(reg_value_complaint): Update complaint text.
	* mdebugread.c (reg_value_complaint): New function.
	(mdebug_reg_to_regnum): Rewrite to watch for bad reg numbers.

gdb/testsuite/ChangeLog:

	* lib/dwarf.exp (_location): Add support for DW_OP_regx.
	* gdb.dwarf2/bad-regnum.c: New file.
	* gdb.dwarf2/bad-regnum.exp: New file.
2015-10-26 16:05:21 -07:00
Doug Evans 1a70ae976b PR python/18938: source -s foo.py with foo.py a symlink to foo.notpy fails
gdb/ChangeLog:

	PR python/18938
	* cli/cli-cmds (source_script_fron_sctream): New arg file_to_open.
	All callers updated.

gdb/testsuite/ChangeLog:

	* gdb.python/python.exp: Add test for symlink from .py file to .notpy
	file.
2015-10-26 14:33:19 -07:00
Doug Evans 372405a5e8 Print address map in output of "mt print psymbols"
gdb/ChangeLog:

	* psymtab.c (struct dump_psymtab_addrmap_data): Define.
	(dump_psymtab_addrmap_1, dump_psymtab_addrmap): New functions.
	(maintenance_print_psymbols): Print address map.
2015-10-26 14:12:51 -07:00
Doug Evans 682b25469e Move __SIGRTMIN.
gdb/ChangeLog:

	* nat/linux-nat.h (__SIGRTMIN): Move here from gdbserver/linux-low.c.

gdb/gdbserver/ChangeLog:

	* linux-low.c (__SIGRTMIN): Move to nat/linux-nat.h.
2015-10-26 13:30:57 -07:00
Doug Evans 963843d4d0 musl: Move W_STOPCODE to common/gdb_wait.h.
gdb/ChangeLog:

	* common/gdb_wait.h (W_STOPCODE): Define, moved here from
	gdbserver/linux-low.c.
	(WSETSTOP): Simplify.

gdb/gdbserver/ChangeLog:

	* linux-low.c (W_STOPCODE): Moved to common/gdb_wait.h.
2015-10-26 13:24:01 -07:00
Doug Evans d41401ace0 Add some casts for building on musl.
gdb/ChangeLog:

	* linux-thread-db.c (find_new_threads_callback): Cast ti.ti_tid to
	unsigned long for debug_printf.
	(thread_db_pid_to_str): Ditto.

gdb/gdbserver/ChangeLog:

	* thread-db.c (find_one_thread): Cast ti.ti_tid to unsigned long
	for debug_printf.
	(attach_thread, find_new_threads_callback): Ditto.
2015-10-26 13:20:12 -07:00
Simon Marchi 1522597b05 guile: Simplify ioscm_make_gdb_stdio_port
As pointed out by Pedro, it's clearer to do it this way.  We can trust
that scm_mode_bits won't try to modify our string, even though it takes
a non-const char *.

gdb/ChangeLog:

	* guile/scm-ports.c (ioscm_make_gdb_stdio_port): Do not pass a
	local char array to scm_mode_bits, use a cast instead.
2015-10-26 15:05:50 -04:00
Simon Marchi 7acd011bef tui: Simplify tui_alloc_content
I stumbled upon this while doing some cxx-conversion work.  Since the
x-family alloc functions throw on failure, it is useless to test their
result for failure.  The else branch of != NULL is basically dead code.

I changed the type of element_block_ptr to struct tui_win_element, which
seems obvious (this is actually what raised the flag, casting the result
of xmalloc to struct tui_win_element* wouldn't work).

gdb/ChangeLog:

	* tui/tui-data.c (tui_alloc_content): Don't check xmalloc
	result.  Change type of element_block_ptr.  Change allocation to
	use XNEWVEC.
2015-10-26 12:58:32 -04:00
Luis Machado 7cc53fba0a Do not pass NULL for the string in catch_errors
I caught a segmentation fault while running gdb.reverse/sigall-reverse.exp,
in a mingw32 GDB, in this code path. It boils down to the code trying to
strlen () a NULL pointer. I tracked things down and it looks like
record_full_message_wrapper_safe is the only offender.

gdb/ChangeLog:

2015-10-26  Luis Machado  <lgustavo@codesourcery.com>

	* record-full.c (record_full_message_wrapper_safe): Pass empty string to
	catch_errors call instead of NULL.
2015-10-26 11:17:29 -02:00
Simon Marchi 48ffa2b8cd Fix constness problem in ioscm_make_gdb_stdio_port
ioscm_make_gdb_stdio_port passes const char pointers (literal strings) to
scm_mode_bits, which takes a non-const char pointer.  Ideally, we would
change scm_mode_bits to take a const char pointer, but it's not part of
an API we control.

Instead, it's easy enough to build the string to pass to scm_mode_bits in
a (non-const) char array and pass that.

gdb/ChangeLog:

	* guile/scm-ports.c (ioscm_make_gdb_stdio_port): Pass non-const
	char pointer to scm_mode_bits.
2015-10-26 08:41:39 -04:00
Simon Marchi 585a269afb symtab.c: Add cast
gdb/ChangeLog:

	* symtab.c (default_make_symbol_completion_list_break_on_1): Add
	cast.
2015-10-26 08:41:38 -04:00
Simon Marchi e0dd41e967 gdbscm_memory_port_write: use local variable to avoid adding casts
By having a local variable of type (const gdb_byte *), we can avoid adding
two casts.

gdb/ChangeLog:

	* guile/scm-ports.c (gdbscm_memory_port_write): Declare new
	"data" local variable and use it.
2015-10-26 08:41:37 -04:00
Simon Marchi 74ef968fba scm-symbol.c: Add (domain_enum) casts
We currently pass integers as domain_enums to lookup_symbol.  The
most obvious fix is to add casts there.

I first thought of changing the type of the domain variables to
domain_enum.  However, because we pass a pointer to them to
gdbscm_parse_function_args, which expects them to be integers (because
of the format string), I don't think it would be correct.  If the enum
does not have the same size as an int, gdbscm_parse_function_args could
write past the memory of domain, overwriting something else on the
stack.

gdb/ChangeLog:

	* guile/scm-symbol.c (gdbscm_lookup_global_symbol): Add
	domain_enum cast.
	(gdbscm_lookup_symbol): Likewise.
2015-10-26 08:41:36 -04:00
Jan Kratochvil 27dc26ab39 Fix compile.exp error message expectation
commit cdaec3f3e7
Author: Luis Machado <lgustavo@codesourcery.com>
Date:   Thu Aug 27 02:00:16 2015 -0300
    Mention language in compile error message

regressed:

-PASS: gdb.compile/compile.exp: compile code globalvar
+FAIL: gdb.compile/compile.exp: compile code globalvar

Update the expected message.

gdb/testsuite/ChangeLog
2015-10-25  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.compile/compile.exp (compile code globalvar): Update expectation
	for a change by "Mention language in compile error message".
2015-10-25 12:16:10 +01:00
Iain Buclaw 2d5a88dc50 Re-apply change for handling non-local references in nested functions.
gdb/ChangeLog:

	* d-exp.y: Remove an obsolete comment and propagate the block
	information to the produced expression.
2015-10-25 09:17:24 +01:00
Simon Marchi f4ee58bde9 tui-data.c: Remove unnecessary casts
The (void *) casts make the build fail in C++ mode and are unnecessary.

gdb/ChangeLog:

	* tui/tui-data.c (tui_add_to_source_windows): Remove void *
	cast.
	(tui_add_content_elements): Likewise.
2015-10-24 22:40:37 -04:00
Simon Marchi 1650ca1124 cli-setshow.c: Constify variable
Fixes:

/home/simark/src/binutils-gdb/gdb/cli/cli-setshow.c:390:13: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
  p = strchr (arg, ' ');
             ^
gdb/ChangeLog:

	* cli/cli-setshow.c (do_set_command): Constify p.
2015-10-24 22:29:16 -04:00
Simon Marchi 55e5bf59f0 Replace (void *) cast with (gdb_byte *)
Fixes:

/home/simark/src/binutils-gdb/gdb/nat/linux-ptrace.c:207:6: error: invalid conversion from ‘void*’ to ‘gdb_byte* {aka unsigned char*}’ [-fpermissive]
   pc = (void *) (uintptr_t) l;
         ^

gdb/ChangeLog:

	* nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Replace
	(void *) cast with (gdb_byte *).
2015-10-24 18:36:26 -04:00
Simon Marchi 49e66b4deb proc-service.c: Add (gdb_byte *) cast
A cast here is necessary, just as it's necessary in ps_pdwrite just
below.  The type of buf can't be changed, since it's fixed in the ps_pd*
API.

gdb/ChangeLog:

	* proc-service.c (ps_pdread): Add cast.
2015-10-24 18:36:25 -04:00
Simon Marchi cfcb22a541 sparc64-tdep.c: Don't assign using memcpy return
This:

  valbuf = memcpy (buf, valbuf, len);

causes a build failure in C++, because memcpy returns the value of
"buf" as a void *.  Instead of adding a cast, we can just do the
assignment separately.

gdb/ChangeLog:

	* sparc64-tdep.c (sparc64_store_arguments): Split assignment of
	valbuf.
2015-10-24 18:36:24 -04:00
Simon Marchi ce746418ef ia64-tdep.c: Remove (void *) casts
Remove these (void *) casts, which cause a build failure in C++ mode.

gdb/ChangeLog:

	* ia64-tdep.c (ia64_pseudo_register_write): Remove cast.
	(ia64_push_dummy_call): Remove cast and change type of "to" to
	array of gdb_byte.
2015-10-24 18:36:23 -04:00
Simon Marchi a55515eecb Add mmap casts in linux-btrace.c
gdb/ChangeLog:

	* linux-btrace.c (linux_enable_pt): Add cast to mmap return.
2015-10-23 19:54:09 -04:00
Simon Marchi 6ecf4e06a4 Add cast to observer.sh
gdb/ChangeLog:

	* observer.h (observer_${event}_notification_stub): Add cast.
2015-10-23 16:58:13 -04:00
Antoine Tremblay 3db2885585 Remove set_breakpoint_data definition in GDBServer.
This patch removes the now unused set_breakpoint_data function from mem_break.h

gdb/gdbserver/ChangeLog:

	* mem-break.h (set_breakpoint_data): Remove.
2015-10-23 13:21:33 -04:00
Antoine Tremblay fb78e89c56 Fix nto,spu and win32 builds of GDBServer.
This patch fixes the build that was broken by :
https://sourceware.org/ml/gdb-patches/2015-10/msg00369.html

It implements the sw_breakpoint_from_kind operation on these targets and removes
the calls to set_breakpoint_data.

Compiliation tested on win32.

Not tested : nto, spu.

gdb/gdbserver/ChangeLog:

	* nto-low.c (nto_sw_breakpoint_from_kind): New function.
	(struct target_ops) <sw_breakpoint_from_kind>: Initialize.
	(initialize_low): Remove set_breakpoint_data call.
	* spu-low.c (spu_sw_breakpoint_from_kind): New function.
	(struct target_ops) <sw_breakpoint_from_kind>: Iniitalize.
	(initialize_low): Remove set_breakpoint_data call.
	* win32-low.c (win32_sw_breakpoint_from_kind): New function.
	(struct target_ops) <sw_breakpoint_from_kind>: Initialize.
	(initialize_low): Remove set_breakpoint_data call.
2015-10-23 13:21:11 -04:00
Antoine Tremblay 2e6ee069ae Refactor default_breakpoint_kind_from_pc to be used by all targets in GDBServer.
This patch moves default_breakpoint_kind_from_pc to target.c and creates a macro
so that all targets can easily use it.

This allows the breakpoint_kind_from_pc operation to be left unimplemented in
targets that do not need it.

This is preparation to fix the win32/nto/spu build that was broken by this
patch: https://sourceware.org/ml/gdb-patches/2015-10/msg00369.html

No regression on Ubuntu 14.04 x86-64 with gdbserver-{native-extended}

gdb/gdbserver/ChangeLog:

	* linux-low.c (default_breakpoint_kind_from_pc): Move to target.c.
	* mem-break.c (set_breakpoint_at): Use target_breakpoint_kind_from_pc.
	* target.c (default_breakpoint_kind_from_pc): Moved from linux-low.c
	* target.h (target_breakpoint_kind_from_pc): New macro.
2015-10-23 13:20:39 -04:00
Yao Qi 034f1a812d Initialize field insn_count correctly
This patch initialize dsd.insn_count, otherwise, it triggers the assert
below on testings we did recently.

gdb:

2015-10-23  Yao Qi  <yao.qi@linaro.org>

	* aarch64-tdep.c (aarch64_displaced_step_copy_insn): Set
	dsd.insn_count to zero.
2015-10-23 09:23:22 +01:00
Pedro Alves d236ad1955 garbage collect gdb/infrun.c:stop_after_trap
No longer used anywhere.

gdb/ChangeLog:
2015-10-22  Pedro Alves  <palves@redhat.com>

	* infrun.c (stop_after_trap): Delete.
	(clear_proceed_status, handle_signal_stop, struct
	infcall_control_state, save_infcall_control_state)
	(restore_infcall_control_state): Remove references to
	stop_after_trap.
2015-10-22 17:41:10 +01:00
Antoine Tremblay 1652a98612 Fix inconsistent breakpoint kinds between breakpoints and tracepoints in GDBServer.
This patch fixes a regression introduced by :
https://sourceware.org/ml/gdb-patches/2015-10/msg00369.html

Tests : gdb.trace/trace-break.exp and gdb.trace/trace-mt.exp would fail on x86
with gdbserver-{native,extended}.

Before this patch, the breakpoint kind set by GDB with a Z packet and the one
set in the case of a tracepoint would be inconsistent on targets that did not
implement breakpoint_kind_from_pc. On x86 for example a breakpoint set by GDB
would have a kind of 1 but a breakpoint set by a tracepoint would have a kind of
0.

This created a missmatch when trying to insert a tracepoint and a breakpoint at
the same location. One of the two breakpoints would be removed with debug
message : "Inconsistent breakpoint kind".

This patch fixes the issue by changing the default 0 breakpoint kind to be
the size of the breakpoint according to sw_breakpoint_from_kind.

The default breakpoint kind must be the breakpoint length to keep consistency
between breakpoints set via GDB and the ones set internally by GDBServer.

No regression on Ubuntu 14.04 x86-64 with gdbserver-{native-extended}

gdb/gdbserver/ChangeLog:

	* linux-low.c (default_breakpoint_kind_from_pc): New function.
	(linux_breakpoint_kind_from_pc): Use default_breakpoint_kind_from_pc for
	the default breakpoint kind.
2015-10-22 12:23:58 -04:00
Simon Marchi db0f0d0c1d Add cast in python.c
gdb/ChangeLog:

	* python/python.c (_initialize_python): Add cast.
2015-10-22 12:13:19 -04:00
Simon Marchi fb70bc1a74 Add cast in nto-tdep.c
gdb/ChangeLog:

	* nto-tdep.c (nto_inferior_data): Add cast.
2015-10-22 11:58:38 -04:00