Commit Graph

76176 Commits

Author SHA1 Message Date
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
Alan Modra 02e60bf7ba * testsuite/discard_locals_relocatable_test.c: Add a powerpc
relocation referencing .LC0.
	* testsuite/discard_locals_test.sh: Remove FIXMEs.
2013-03-07 05:33:50 +00:00
Alan Modra 8343f03ae2 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
always_inline.  Add assembly for powerpc to avoid GOT.
2013-03-07 05:31:44 +00:00
Alan Modra 3366d57cbc * testsuite/script_test_10.sh: Don't test .bss section
header number.
2013-03-07 05:30:06 +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
Alan Modra 309a4436e3 daily update 2013-03-06 23:00:05 +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
Alan Modra 3ab6909a0c * ldfile.c (ldfile_open_command_file_1): Return after einfo
to avoid warning.
2013-03-06 13:48:46 +00:00
Alan Modra c54e2ec142 * strings.c (get_char): Dispense with buf[]. Instead shift
chars into big-endian value and byte-swap later if
	little-endian.  Don't EOF check value read from object.
2013-03-06 13:40:51 +00:00
Alan Modra 6c77229c00 * powerpc.cc (class Powerpc_relobj): Move some member functions.
(Target_powerpc::symval_for_branch):  Add symtab param.  Update
	all callers.  Handle folded sections.
	(Target_powerpc::do_gc_add_reference): Don't cast dynamic object
	to Powerpc_relobj.
	(Global_symbol_visitor_opd::operator()): Likewise.
2013-03-06 12:28:47 +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
Alan Modra b27744474a daily update 2013-03-05 23:00:06 +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
Yufeng Zhang 62b0d0d5f3 Add to the AArch64 GAS the missing support for hexadecimal-format
floating-point literal in the FMOV instruction.

gas/

	* config/tc-aarch64.c (aarch64_imm_float_p): Rename 'e' to 'pattern';
	add comment.
	(aarch64_double_precision_fmovable): New function.
	(parse_aarch64_imm_float): Add parameter 'dp_p'; call the new
	function; handle hexadecimal representation of IEEE754 encoding.
	(parse_operands): Update the call to parse_aarch64_imm_float.

gas/testsuite/

	* gas/aarch64/diagnostic.s: Add test.
	* gas/aarch64/diagnostic.l: Update.
	* gas/aarch64/illegal.s: Add test.
	* gas/aarch64/illegal.l: Update.
	* gas/aarch64/fpmov.s: New file.
	* gas/aarch64/fpmov.d: New file.
2013-03-05 16:31:44 +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
Corinna Vinschen a07ee50e95 * configure.host: Add x86_64-*-cygwin* as valid host.
* configure.tgt: Add x86_64-*-cygwin* as valid target.
	* emultempl/pep.em: Handle different requirements for Cygwin in terms
	of start addresses for executables and DLLs, based on memory model in
	http://cygwin.com/ml/cygwin-developers/2013-02/msg00027.html
2013-03-05 11:54:29 +00:00
Corinna Vinschen ee36d91878 * configure.in: Build DLL tools on x86_64-*-cygwin* as well.
* configure: Regenerate.
2013-03-05 11:52:12 +00:00
Corinna Vinschen 48385e3898 * config.bfd: Add x86_64-*-cygwin to list of supported targets. 2013-03-05 11:47:01 +00:00
Alan Modra 13762d2ee4 PR ld/15222
ld/
	* ldlang.c (lang_size_sections_1): When given an lma_region align
	LMA as per VMA only if lma_region is the same as region.
ld/testsuite/
	* ld-scripts/rgn-at6.s, * ld-scripts/rgn-at6.t, * ld-scripts/rgn-at6.d,
	* ld-scripts/rgn-at7.t, * ld-scripts/rgn-at7.d: New tests.
2013-03-05 02:55:27 +00:00
gdbadmin da797b631b *** empty log message *** 2013-03-05 00:00:03 +00:00
Alan Modra ea9346df17 daily update 2013-03-04 23:00:06 +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
Nick Clifton fafd911d9f * elfcomm.c (error): Flush stdout before emitting the error
message.
	(warn): Likewise.
2013-03-04 14:22:25 +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
Alan Modra f75e0e336f * elf32-ppc.c (ppc_elf_relocate_section <R_PPC_PLTREL24>): Adjust
non-zero addends when relocatable, rather than addends >= 32768.
	Always zero "addend" before applying relocation.
2013-03-04 12:12:11 +00:00
Nick Clifton 17e3916e23 * archive64.c (bfd_elf64_archive_write_armap): Fix calculation of
file pointer offsets for thin archives.
2013-03-04 09:21:43 +00:00
Alan Modra a39e4af6dc * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
* testsuite/Makefile.in: Regenerate.
2013-03-04 00:48:01 +00:00
gdbadmin 674330e8a7 *** empty log message *** 2013-03-04 00:00:03 +00:00