Commit Graph

76217 Commits

Author SHA1 Message Date
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
Alan Modra dc3714f31f * gold.cc (queue_middle_tasks): Move detect_odr_violations..
* layout.cc (Layout_task_runner::run): ..to here.
	* symtab.h (struct Symbol_location): Extract from..
	(class Symbol_table): ..here.
	* symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
	* target.h (class Target): Add function_location and
	do_function_location functions.
	(class Sized_target): Add do_function_location.
	* object.h (class Sized_relobj_file): Move find_shdr..
	(class Object): ..to here.
	* object.cc: Likewise.  Update to suit.  Instantiate.
	(Sized_relobj_file::find_eh_frame): Update find_shdr call.
	* powerpc.cc (class Powerpc_dynobj): New.
	(Target_powerpc::do_function_location): New function.
	(Powerpc_relobj::do_find_special_sections): Update find_shdr call.
	(Powerpc_dynobj::do_read_symbols): New function.
	(Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2013-03-10 23:08:18 +00:00
Alan Modra 3bcc542289 daily update 2013-03-10 23:00:05 +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
Alan Modra 9d0678b914 daily update 2013-03-09 23:00:05 +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
Alan Modra f6f6557d88 daily update 2013-03-08 23:00:06 +00:00
Ian Lance Taylor 956b03bbdf * options.cc (General_options::string_to_object_format): Accept
"default".
2013-03-08 22:34:46 +00:00
Nick Clifton 59c108f731 * elf64-aarch64.c (elf_backend_can_gc_sections): Enable
gc-section support.
        (elf64_aarch64_gc_sweep_hook): Handle GOT, TLS and PLT related relocs.

        * lib/ld-lib.exp (check_gc_sections_available): Remove aarch64
from list of
        targets that don't support gc-section.
2013-03-08 17:37:30 +00:00
Nick Clifton 87a8d6cbe0 PR binutils/15241
* lm32.cpu (Control and status registers): Add CFG2, PSW,
	TLBVADDR, TLBPADDR and TLBBADVADDR.

	* lm32-desc.c: Regenerate.
2013-03-08 17:25:12 +00:00
Nick Clifton abb3f6cca7 * elf-bfd.h (elfcore_write_s390_tdb): Add prototype.
* elf.c (elfcore_write_s390_tdb): New function.
	(elfcore_write_register_note): Call it.
	(elfcore_grok_s390_tdb): New function.
	(elfcore_grok_note): Call it.

	* readelf.c (get_note_type): Add NT_S390_TDB.
2013-03-08 17:13:31 +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
Maciej W. Rozycki af924177b5 * elfxx-mips.c (mips_elf_allocate_lazy_stub): Correct data type. 2013-03-08 11:50:27 +00:00
Chung-Lin Tang 8e723a1045 2013-03-08 Chung-Lin Tang <cltang@codesourcery.com>
* write.h (struct fix): Add fx_dot_frag field.
	(dot_frag): Declare.
	* write.c (dot_frag): New variable.
	(fix_new_internal): Set fx_dot_frag field with dot_frag.
	(fixup_segment): Base calculation of fx_offset with fx_dot_frag.
	* expr.c (expr): Save value of frag_now in dot_frag when setting
	dot_value.
	* read.c (emit_expr): Likewise. Delete comments.
2013-03-08 10:17:00 +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
Alan Modra 4bead2d512 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
pointer to Post_fde.
	(struct Post_fde): Move definition to here..
	* ehframe.cc (struct Post_fde): ..from here.
	(Cie::write): Don't alloc Post_fde.
	(Eh_frame::do_sized_write): Update.  Don't free Post_fde.
2013-03-07 23:27:53 +00:00
Alan Modra 457f4f60b6 daily update 2013-03-07 23:00:05 +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
H.J. Lu be05d20139 Rewrote i386_index_check
* config/tc-i386.c (flag_code_names): Removed.
	(i386_index_check): Rewrote.
2013-03-07 21:40:06 +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